frustum culling

Started by
8 comments, last by Dani008 18 years, 7 months ago
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/
Mike C.http://www.coolgroups.com/zoomer/http://www.coolgroups.com/ez/
Advertisement
It doesn't get culled.
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/
Mike C.http://www.coolgroups.com/zoomer/http://www.coolgroups.com/ez/
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).
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.
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).
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/
Mike C.http://www.coolgroups.com/zoomer/http://www.coolgroups.com/ez/
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.
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.
"I must not fear. Fear is the mindkiller. Fear is the little death that brings total obliteration. I will face my fear. I will permit it to pass over me and through me. And when it has gone past me I will turn to see fear's path. Where the fear has gone there will be nothing. Only I will remain." ~Frank Herbert, DuneMy slice of the web
Why the hell do you want some GameTutorials.com Tutorials? Use this: http://www.ultimategameprogramming.com/
Thanks

This topic is closed to new replies.

Advertisement