Sign in to follow this  
Low Bias

Argh! Where Should I Frustum Cull In DirectX!? :)

Recommended Posts

I've covered some of this in another topic, but I think this warrants a new topic as my question has changed somewhat. My main reference for this frustum culling business right now is... http://www2.ravensoft.com/users/ggribb/plane extraction.pdf If I use the projection matrix to extract the frustum planes, I get the planes in homogeneous clipping space. I'm still a bit shaky on the homogeneous part, but that's okay for now. If I use a concatenated view and projection matrix, I get the planes in world space. If I use the world, view, and projection matrices, I get the planes in object space. Where should I be frustum culling? If I do it in object space, I have to recalculate the frustum planes for every object?! If I do it in world space, I only have to calculate the frustum planes once per frame, but I have to manually apply the world transformations so I can use just the view and projection matrices. This all seems sort of painful. Am I missing something? I would really appreciate some advice.

Share this post


Link to post
Share on other sites
AFAIK, you should only have to calculate the frustum planes once IF the camera stays still. When the camera moves, moving the view frustum at the same time, you need to recalculate.

Now, you DO have to check every object against the frustum every frame, unless your objects don't move or you put them in some kind of space partition (quad/octrees) and test the partitions.

EDIT: Multiply model matrix times projection matrix...

Share this post


Link to post
Share on other sites
[quote]Original post by chxfryer
AFAIK, you should only have to calculate the frustum planes once IF the camera stays still. When the camera moves, moving the view frustum at the same time, you need to recalculate.[/QUOTE]

This is what I'm trying to understand. I realize that if you use the projection matrix, you have the frustum planes in clip space. But these only do you good if you can cull in clip space. Does this not mean that you have to have your vertices transformed to clip space as well? How do you jump in at that point and cull after that transformation? Doesn't DirectX take over and perform all the transformations after you call DrawIndexed Primitive?

Quote:
EDIT: Multiply model matrix times projection matrix...


?

Share this post


Link to post
Share on other sites
Quote:
Original post by Low Bias
If I use a concatenated view and projection matrix, I get the planes in world space.

If I do it in world space, I only have to calculate the frustum planes once per frame, but I have to manually apply the world transformations so I can use just the view and projection matrices.

If your planes are in World Space and you use Bounding Spheres for your objects, then you only need to transform 1 point per object into World Space. That doesn't seem too painful.

If you have a lot of objects you'll also want to use some higher level culling like a Quad tree since that can quickly reduce the number of objects you'll cull via the frustrum.

Share this post


Link to post
Share on other sites

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