Sign in to follow this  

frustum culling

This topic is 4482 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Let's say you have four points that define a quad. All the points are outside the view frustum, but the interior of the quad does intersect the view frustum. Does the quad get frustum culled? If so, it seems like if you get too close to a wall in a 3d maze it will get frustum culled (even if you have a real close near plane). mike http://www.coolgroups.com/

Share this post


Link to post
Share on other sites
If it doesn't get culled, what exactly does get culled? I thought the frustum culling checked if the endpoints were inside or outside of the frustum and culled based on that.

mike
http://www.coolgroups.com/

Share this post


Link to post
Share on other sites
Quote:
Original post by mike74
If it doesn't get culled, what exactly does get culled? I thought the frustum culling checked if the endpoints were inside or outside of the frustum and culled based on that.

mike
http://www.coolgroups.com/


If you want a precise frustum cull you need to cull your polygon against the frustum.
That is
for each plane in the frustum you split the polygon in two: the inner and the outer one (note that the polygon can be also entirely in or entirely out).
After each plane you discard the outer.
If the inner polygon is empty your polygon is culled.

If you want I can post a variant I use but I'm sure you can google for a tutorial about this classic algorithm (see also BSP).

Share this post


Link to post
Share on other sites
Quote:
Original post by mike74
If it doesn't get culled, what exactly does get culled? I thought the frustum culling checked if the endpoints were inside or outside of the frustum and culled based on that.
A frustum culling algorithm that culls polygons that are inside the frustum (or have parts that are inside the frustum) would be pretty silly.

Share this post


Link to post
Share on other sites
Just to be clear, OpenGL only performs face culling (if requested); frustum culling is up to you.

A couple comments on doing your own culling. First of all, FYI it's not necessary to actually clip the polygon to the frustum - a simple separating axis test or variant thereof will do the trick. Also, it generally doesn't pay to cull on a per-polygon level. Instead, you'll want to sort your polygons into some sort of scene graph and cull by nodes (each of which may contain many polygons).

Share this post


Link to post
Share on other sites
What exactly do you mean when you say face culling?

If I try to display a polygon in OpenGL, and it's outside the view frustum, I'm pretty sure it just gets discarded. Isn't this frustum culling?

mike
http://www.coolgroups.com/

Share this post


Link to post
Share on other sites
Quote:
What exactly do you mean when you say face culling?

If I try to display a polygon in OpenGL, and it's outside the view frustum, I'm pretty sure it just gets discarded. Isn't this frustum culling?
I should state that I'm not an expert on OpenGL or how it handles things internally.

I'm pretty sure however that OpenGL clips primitives to the frustum, but it doesn't cull them per se. The only culling it does is face culling, by which I mean discarding polygons whose visible side faces away from the viewer. See here for a discussion of face culling. I'm avoiding the more common term 'backface culling' because you can set OpenGL to cull the front face instead.

You can do frustum culling yourself on a per-polygon level, but this is unlikely to buy you any performance gains. The real strength of frustum culling lies in combining it with some sort of hierarchical spatial partitioning scheme, such as an octree, AABB tree, or BSP tree. This allows for culling large chunks of world geometry with little effort. With any reasonably complex environment, this will be a win over the brute-force approach.

Frustum culling does not address the issue of occlusion, that is, culling objects not because they lie outside the frustum but because they are obscured by another object. For games based on the Quake engine and its derivatives, the solution to this has generally been the PVS (potentially visible set). There are however many other ways to approach occlusion culling, which continues to be an area of research.

Share this post


Link to post
Share on other sites
This tutorial used to be free (not very impressed by what gametutorials have done by charging for this stuff)

http://www.gametutorials.com/gtstore/pc-80-1-frustum-culling.aspx

but it demonstrates it quite nicely. Google it & there might be a copy lying around somewhere.

Share this post


Link to post
Share on other sites

This topic is 4482 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this