Sign in to follow this  
Trip99

Calculating a BB from frustum planes

Recommended Posts

You can either generate the 8 corners in clip space and use the inverse perspective/camera/world matrix to transform them into world space, or solve the three frustum plane equations for each corner point in world space directly.

Share this post


Link to post
Share on other sites
Thanks I am trying that, just one question, when calculating the matrix is it the (inverse perspective) * (camera) * (world) or is it inverse (perspective * camera * world) ?

Share this post


Link to post
Share on other sites
I think it is working, I ended up creating 8 clip points and transforming them by the inverse of the view matrix * the projection matrix (this is using Direct3D terminology). I then find the max and min values in that array and that defines my AABB. Like I say it **seems** correct although more testing needed. Thanks for the response.

Share this post


Link to post
Share on other sites
(just for reference)

These are equivalent:

(inverse projection) * (inverse camera)
inverse (camera * projection)

I can't remember the exact order D3D does it so you'd need to check the docs, the simplest way to ensure you're correct is to construct the exact matrix D3D is using and then just invert that.

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