PDA

View Full Version : Occl. Culling - Bouding Rectangle vs Box?

Navega-san
04-21-2010, 06:05 AM
I was reading the Occlusion Query extensions NV and ARB from OpenGL and they both recommend you render the bounding volumes representing the occludees.
In the end, that would be 12 triangles for every occludee, if you happen to use a simple bounding box.
Wouldn't it be more efficient to find a "3D" bounding rectangle instead, since it is made of only 2 triangles but still represents the whole area of the occludee?

EDIT: Also, are there any materials regarding the construction of a bounding rectangle that has the same depth as the occludee it stands for?

carsten neumann
04-21-2010, 08:32 AM
your edit gives a hint at why using a rectangle is problematic: it would have to somehow be representative for the object (which is 3 dimensional) while being flat.

I imagine using a rectangle would also make occlusion testing quite pessimistic because the rectangle would have to have a depth that is equal to the depth of the closest vertex of the object - unless you want to use a rectangle that is not parallel to the near and far planes, but that would make it more difficult to compute.

Finally, the rectangle is view dependent (unless I'm missing something), so you'd have to update it whenever the camera moves. It may easily be faster to render the bounding box and not have to worry about changing the data all the time.

pjcozzi
04-21-2010, 08:48 AM
Stick with the bounding box. Going from 12 to 2 triangles is unlikely to improve performance considering everything else that is going on. In fact, consider throwing more triangles at it to get a more precise occlusion result. For example, instead of using a single bounding box, use a few smaller bounding boxes that provide a tighter fit. The increase in triangle count is likely to pay for itself and then some with reduced false positives.

Regards,
Patrick

Jan
04-21-2010, 09:10 AM
Also the less precise your proxy is (ie. your rectangle/box/whatever) the larger it will usually be and thus take up more fragments, which can become a bottleneck much faster then vertex-processing. So try to find a shape that approximates your real object tightly with as few triangles as possible. In general a box is just the easiest solution that works well.

Jan.

Navega-san
04-21-2010, 10:23 AM
Thank you for the replies; bounding-box it is.