Advertisement

frustum culling

Started by May 07, 2002 11:30 AM
3 comments, last by Muksitul 22 years, 9 months ago
here http://www.markmorley.com/opengl/frustumculling.html mark morley says in the section "Is This Box In the Frustum?" We can test to see if any of the eight corners are within the frustum of course, and that would work for most cases, but what happens if the box totally encloses the frustum? All of the corners are outside of the frustum, but it''s still visible Here it is (and this one works, even if the cube encloses the frustum): CODE.. where is this happening, i mean how is he finding out that if the box totally encloses the frustum its visible . does that mean even if the box totally surrounds the frustum its visible ? muksitul
"does that mean even if the box totally surrounds the frustum its visible ?"

What do *you* think?
-=[Megahertz]=-
Advertisement
It might help if you actually posted the code rather than "Code".

Death of one is a tragedy, death of a million is just a statistic.
If at first you don't succeed, redefine success.
if the frustum is completely enclosed by the bounding box of an object then you can be 99% sure that the object is visible (depending on topology of geometry) and so should be drawn.

As a side note - it is not enough to do frustum culling by only the tests 1) is any corner in frustum and 2) is frustum enclosed by box.

there are several special cases that need to be tested for. e.g. a shallow object that is wider than the frustum but is still in it. This box will not have any corners in the frustum but will not enclose the frustum either.

hope this makes sense.
I reckon this is being looked at from the wrong way.

Don''t think of it as a box and a frustum, think of a bunch of points and a bunch of planes.

For each plane, you know the plane''s normal, right? It''s the abc component of its equation. If you''ve got axis aligned bounding boxes, then you can make up a point that is "in the same direction" as the normal, and that''s the only point you need to test.

Say if your normal has positive x, negative y, positive z, then you make up a point using the max x, min y, max z components of your bounding box.

Test that point against the plane, and repeat the whole thing for each plane in the frustum.

If any of the tests fail then the whole box is outside.


Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions

This topic is closed to new replies.

Advertisement