Jump to content
  • Advertisement
Sign in to follow this  
kevlur

How to get the frustum bounding box?

This topic is 4897 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 all, once i have the normal and the distance of my 6 planes that define the frustum, how can i get the frustum bounding box? Thanks Kev

Share this post


Link to post
Share on other sites
Advertisement
Browse to google.

Search for "frustum culling"

Here is the first hit:

http://www.flipcode.com/articles/article_frustumculling.shtml

Happy Coding...

Share this post


Link to post
Share on other sites
Thanks for the info, but in that article the author calculate the frustum bounding sphere, and i need the frustum bounding box.
How can i get the min and max points of the frustum bounding box?

Thanks again

Share this post


Link to post
Share on other sites
Axis-aligned? If so, just find the minimum and maximum range of your object. In most cases, this is vertex positions. Find the vertex with the lowest x coordinate. That x is your box left coordinate. The highest x coordinate is the box right coordinate. etc. That's all there is to it, until you start rotating things. That's why the article used a sphere. Sphere's are also way faster to reject.

Share this post


Link to post
Share on other sites
If you only want an axis aligned bounding box of the frustum in worldspace, then you don't need the frustum planes.

You can get each of the 8 corner points of the worldspace frustum by multiplying the eight corner points of the clip space unit cube with the inverse view-projection matrix iP:

Point 1 = (-1, -1, -1, 1) * iP
Point 2 = (1, -1, -1, 1) * iP
Point 3 = (1, 1, -1, 1) * iP
Point 4 = (-1, 1, -1, 1) * iP

Point 5 = (-1, -1, 1, 1) * iP
Point 6 = (1, -1, 1, 1) * iP
Point 7 = (1, 1, 1, 1) * iP
Point 8 = (-1, 1, 1, 1) * iP

These points will form the common flat pyramid shape. Now get the minimum and maximum for each axis at each point, and you have bounding box.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!