I don’t think it is beneficial to have a list with all occluders and one for all items that could be occluded. and test all occluders aganist all items that possibly could be occluded even if they are very far apart.
Should you VF cull the occluders before you start check if any objects are occluded bye it?
Sorry for being unclear, but my question is. How do you organize occluders and items that could be occluded in a scene?
Depth sort. You should already be depth sorting objects to draw the transparent surfaces correctly. Keep two variables to track how many items are in your list; “total items” and “not frustum culled”. When you frustum cull something, move it to the end of the list. And then subtract “not frustum culled”. When you can see something, move it back into the body of the list and add “Not frustum culled”. When rendering beyond the frustum culling stage, ignore everything past the number of items not frustum culled. Don’t forget to adjust the numbers correctly when deleting your object.
Thanks for your input but I am not really sure that you understand my problem, or I don’t understand you point.
Witch item should be tested against witch occluders? Should all items in a scene be tested against a occluder even if they are very far apart.
Occlusion culling us usually applied by “test rendering” a bounding volume (or some other placeholder geometry that can be drawn fast) instead of the actual object. I put “test rendering” because the OC test does not really need to draw anything, you can stop as soon as one (or a small number of) pixel(s) would need writing to the framebuffer. In that case you conclude that your real geometry is not occluded and render it.
To answer your question: normally OC is not done by explicitly testing pairs of objects, but by having the GPU determine that some fragments of an object would actually get written to the framebuffer (i.e. pass all tests like scissor, clipping, and especially depth test).
By rendering from front to back, the hope is to get the largest occluders first and hopefully don’t have to submit many of the far away objects to the GPU.
Thank you for input. This is what I am using.
Doesn’t objects have to be tested against each other if I use this tutorial. Maybe you mean something like a HOM three?