Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
    
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. –  Sean Middleditch Feb 21 '13 at 2:00
    
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. –  zenkai Feb 21 '13 at 2:03
add comment

1 Answer

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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