Frustrum Points Coordinates

I would like to get (with a fast method) the points that limits the frustum (4 for the front near plan & 4 for the front far plan)
I just would like coordinates of these point with a few instructions.
I uses for the moment, the intersection plane from the planes got by multiplying projection & modelview matrix.
But I’m not enough good in maths to get a fast solution
Yes I need to learn
But If anyone got a simple solution…
Thanks

take a look at www.markmorley.com

Yes it’s exactly what I used, but it give only the planes for the frustrum.
I would like to know if there is a fast method (like this one) to get points (instead of planes) of the frustrum.

I think also this method gives the points in its core, but my maths aren’t enough good to abstract this theory.

Thanks

wich points? you mean the 8 edgepoints?

well, search some code that intersects 3 planes and returns a point of this intersection… do this for all 8 points with the right planes, and you’re done…

or you could backproject the unitcube…

Yes thank you, but it’s I used (intersection by three plane).
But I’ve found an easier way to do with glUnProject (using ViewPort Limits).
It works fine and it’s faster than my algo using 3 plane intersection.

Thanks anyway

The projection matrix transforms the camera space fustrum to a 2x2x2 cube centered at the origin (the clip cube). So to get the corners of the fustrum in camera space, transform the corners of the clip cube by the inverse of the projection matrix:

[ inverse Projection ] x [ -1, -1, -1 ]  
                         [ -1, -1, +1 ]  
                         [ -1, +1, -1 ]  
                         [ -1, +1, +1 ]  
                         [ +1, -1, -1 ]  
                         [ +1, -1, +1 ]  
                         [ +1, +1, -1 ]  
                         [ +1, +1, +1 ]  

If you want the points in world space, then transform these points by the inverse of the view matrix.

As for computing the inverses:

- Appendix G of the Red Book gives the inverse of the projection matrix, if you have the l, r, b, t, n & f values.

- You can probably find a robust matrix inversion routine with google, or search this forum.  I'm sure its been mentioned before....

- All the zero's in the projection matrix make it possible to solve for the closed form of the inverse.  It takes a bit of algebra, but the result is probably more accurate than a general matrix inversion.

- the view matrix is usually separable into a rotation and a translation, e.g. from gluLookat:  TR, so the inverse is T'R'.  finding T' is trivial.  R is an orthogonal rotation matrix, so R' is just the transpose of R.