PDA

View Full Version : testing objects if they were rendered



Iblues76
05-12-2011, 12:17 PM
If I have a set of many spheres in the screen, as I move closer using a "camera" some of the spheres will disappear from view. How can I test which spheres are not visible? for example, to my right and left of where I'm looking at?
thanks,
Francisco

carsten neumann
05-12-2011, 01:40 PM
The term to google is frustum culling.

You build a hierarchy of bounding volumes around your objects and test the bounding volume against the view frustum. If they intersect you test the next level of volumes in the hierarchy until you've reached the leaves. If a leaf volume intersects the frustum you assume the object to be visible and render it.
Of course this is only a performance win if you can perform the testing faster than simply rendering the objects regardless of visibility - which means the objects to test need to be complex enough. In your case you may need to group a number of spheres into a leaf of your bounding volume hierarchy for best performance.

Iblues76
05-13-2011, 07:43 AM
thank you