1
\$\begingroup\$

I need to do frustum culling where the bounding boxes are in world-space to determine which entities get to be updated/drawn. I was trying to use the classic projection/view matrix plane extraction method but it doesn't seem to work with perspective matrices created by GLM. Is this method appropriate for world-space culling? It seems like it would be (takes the eye position into account and the projection matrix shapes the frustum).

I've only looked at the near/far planes extract so far and they're wrong for a frustum sitting at the origin (Both have a c component that's negative which means near and far are facing the same direction). Also, since the d components can't match the near/far clipping values with this method is it wrong for world-space culling?

\$\endgroup\$
  • \$\begingroup\$ Are you using the plane extraction algorithm for OpenGL-style right-handed column-major projection matrices. They are not the same as typical D3D matrices. Make sure you know which handed-ness your algorithm uses (GL/glm is right-handed by convention), and to remember that glm matrices are column-major. I know I can easily extract frustrum planes from a GL projection matrix identical to what glm makes, so it definitely works and is doable. \$\endgroup\$ – Sean Middleditch Feb 21 '13 at 2:00
  • \$\begingroup\$ Yes I'm extracting for column-major. It was originally written as row-major but when I switched to GLM I updated it. It did actually pass my tests when it was written for row-major. I'm not sure that GLM produces a projection matrix identical to OpenGL's - in the header it appeared to be row-major. \$\endgroup\$ – zenkai Feb 21 '13 at 2:03
1
\$\begingroup\$

Figured out the problem - GLM's interface for accessing the matrix is backwards compared to the matrix used by the original frustum extraction paper for OpenGL.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.