Calculating a BB from frustum planes

Started by
4 comments, last by Trip99 19 years, 4 months ago
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?
------------------------See my games programming site at: www.toymaker.info
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.
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) ?
------------------------See my games programming site at: www.toymaker.info
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.
------------------------See my games programming site at: www.toymaker.info
(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.
I should have remembered that :) It all seems to be working - thanks for your help.
------------------------See my games programming site at: www.toymaker.info

This topic is closed to new replies.

Advertisement