This i my following flowtrace for the tree drawing
0- Generate n = (nbr of blocks of triangles + nbr of octree cells) occlusion query. This is done every time a new sets of groups of triangles with identical “states” is added to the tree
1- Mark as frustum culled all octree cells and groups of triangles belonging to an octree cell that intersect the frustum. Order the 8 cells according to the point of view.
2- Go through the tree from the root. Check current octree cell. If the cell has a pending query (i.e. a query was submitted at the previous frame and not retrieve), retrieve the query and mark the octree cell as occluded if any. If the octree cell was previously occluded, send an occlusion query. If the cell was visible, send a query every 5 frames.
2.1- if the octree cell is occluded, stop there
2.2- if the octree cell is not occluded, display the sets of triangles which are within the cell.
2.2.1- For each group of triangle, check if there is a pending query. If yes retrieve it (it was also submitted at the previous frame) and mark as occluded or not the set of triangles (roughly 3000 triangles). Display the set if visible.
2.2.2- If the cell has branches, go through the branches in accordance with the point of view i.e. front first, back last.
That’s about it. Basically, this method is very simple and while we submit a query at frame i, one only retrieve it at frame i+1. The frame-lag helps masking the latency.
The drawback if one has to generate a large number of occlusions even if most of them are not used.
I understand your method, the only problem is that it seems I am stalling the pipeline after sending the query on the bounding boxes. When you say for later seems to be not late enough in my case.
Of course, one can also trim down the checking of visibility of step 1 by only checking every 5 frames for the visible items.
I think the reference, you are looking at is related to the group at Chapel Hill which is working on the “large model walking” project. The usual sample they work with are the tanker and the plant. They are making intensive use of LOD as well. I have not implemented that yet in my code as I need to find a simple way of decimating the mesh on the fly (there has been several articles thet I remember). The number of pixels returned here can be usefull.
Coming back on the step 1 of your methodology, I tried the following when performing an occlusion testing
method 1:
- disable buffer
- begin occlusion query
- draw bounding box
- end occlusion query
- enable buffer & other state related stuffs
- draw real object
method 2:
- do not disable buffer
- begin occlusion query
- draw real object
- end occlusion query
I found the method 2 to be very slow compare to 1. Have you experienced such a thing?
Eric
The triangles are simply displayed and every 5 frames an occlusion query is