Sign in to follow this  
kevlur

How to get the frustum bounding box?

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
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

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