# Extracting Frustum Planes (Hartmann & Gribbs method)

I have been grappling with the Hartmann/Gribbs method of extracting the Frustum planes for some time now, with little success. There doesn't appear to be a "definitive" topic or tutorial which combines all the necessary information, so perhaps this can be it

First of all, I am attempting to do this in C# (For Playstation Mobile), using OpenGL style Column-Major matrices in a Right-Handed coordinate system but obviously the math will work in any language.

My projection matrix has a Near plane at 1.0, Far plane at 1000, FOV of 45.0 and Aspect of 1.7647.

I want to get my planes in World-Space, so I build my frustum from the View-Projection Matrix (that's projectionMatrix * viewMatrix). The view Matrix is the inverse of the camera's World-Transform.

The problem is; regardless of what I tweak, I can't seem to get a correct frustum. I think that I may be missing something obvious.

Focusing on the Near and Far planes for the moment (since they have the most obvious normals when correct), when my camera is positioned looking down the negative z-axis, I get two planes facing in the same direction, rather than opposite directions. If i strafe my camera left and right (while still looking along the z axis) the x value of the normal vector changes.

Obviously, something is fundamentally wrong here; I just can't figure out what - maybe someone here can?

EDIT: Applying the algorithm to just the Projection matrix (i.e. model and view matrices are identity) I get the Near and Far planes returned as the following; Far: normal[0,0-1], distance 1 Near: normal[0,0,-1], distance -0.3328891

Can someone tell me if these seem correct? Using the algorithm with just the Projection Matrix should return the planes in View Space (camera space)

• I respect that you bring this question here, since it raises the tone on this site, and accordingly I hope someone will answer it, but I suspect it's the kind of question that may be better off moved to cstheory.stackexchange.com. They're more involved with advanced and rather academic algorithms over there. Commented Oct 10, 2012 at 22:45
• I'm not sure that this qualifies as Theoretical Computing Science, but thanks for the reply - it seems to be the same method found here; lighthouse3d.com/tutorials/view-frustum-culling/… except this emphasises the fixed-function pipeline, which I am not using (although I think that, in the case of the fixed-function pipeline, the Model part of the ModelView matrix would be an identity matrix anyway?) Commented Oct 11, 2012 at 10:39
• I definitely agree with you, but answers may be slow in coming, here. It's a matter of what tends to get answered here. I would also suggest either the OpenGL forums or gamedev.net if you need an answer quickly. Wish I could help but I'm using simple arc / planar culling in my project, as it's "good enough" when vertical complexity remains fairly low. Commented Oct 11, 2012 at 11:29
• Answers seem slow in coming everywhere ;) I've posted to GameDev.net and StackOverflow without any response. Apparently this is a common method of plane extraction, but evidently nobody else has had a problem with it before :) If I do ever find a solution I'll be sure to post it here. Commented Oct 11, 2012 at 12:24
• There might be better explanations in some of these books (the GPU Gems series in particular comes to mind, since they generally cover all the best 3D graphics algorithms). PS that is a great site in general, I have found the intersections page useful time after time. Best of luck. Commented Oct 11, 2012 at 13:20

Firstly, extracting from just the projection matrix is a good place to start debugging.

In this case, your near and far plane values should be <0, 0, 1, -1> and <0, 0, -1, 1000> respectively. In practice, it might be off by a little due to floating point rounding errors.