• Advertisement
Sign in to follow this  

Calculating a BB from frustum planes

This topic is 4825 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

Hi, I have a set of frustum planes and I want to calculate an AABB around the frustum. I thought this would be simple but it is doing my head in :) Any ideas?

Share this post


Link to post
Share on other sites
Advertisement
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
I should have remembered that :) It all seems to be working - thanks for your help.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement