Sign in to follow this  
Enrico

Confused with frustum creation

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)
etc.
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

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