Jump to content
  • Advertisement
Sign in to follow this  

Confused with frustum creation

This topic is 4240 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 am currently trying to create a (view) frustum. I know this can be done with the combined modelview-projection matrix, however in Eric Lengyel's book I found another approach: The view frustum planes are always the same in camera space and can be calculated by these formulas:
Near plane = (0,0,-1,-n)
Far plane = (0,0,1, f)
Left plane = (e/sqrt(e*e + 1), 0, -1/sqrt(e*e+1), 0)
where 'e' is the focal length of the camera, 'n' the near plane distance and 'f' the far plane distance. To transform these planes from camera to world space for Frustum Culling, I need the inverse of the camera matrix. The camera matrix is a LookAt()-matrix. As planes are transformed by the inverse, transpose of a matrix, the matrix for transforming the planes from camera to world space is the inverse of the inverse, transpose of the camera matrix, which is seems to be the camera matrix itself. Here is my first problem: I transform the planes with the camera matrix and it works, but should not this be the transpose camera matrix? And the second one: When I compare the planes from the modelview-projection matrix and the transformed planes, there are slight differences, e.g. for the top plane:
Transformed Plane = (0.170789, -0.47821, -0.861479 12.3345)
ModelviewProjection Plane = (0.0665388, -0.186309, -0.980236, 8.0285)
The culling seems to work anyway, but the points and objects get culled out a little later with the transformed planes. The weird thing is that near and plane plane are the same in both cases, only the other four planes have differences. Is anybody using the transformed planes sucessfully? Or shall I stick with the planes from the modelviewprojection matrix? Thanks, Enrico

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!