GLM - Calculating the frustum from the projection matrix

Pladnius Brooks picture Pladnius Brooks · Aug 2, 2012 · Viewed 11.4k times · Source

GLM provides a way to declare a projection matrix:

projectionMatrix = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 1000.f);

From this, I want to be able to check to see if bounding boxes are in my frustum. How do I obtain the frustum planes or whatever it is I would need to calculate this from the projection matrix? Is this even the correct way to do it?

Answer

brano picture brano · Aug 2, 2012

This will help: http://crazyjoke.free.fr/doc/3D/plane%20extraction.pdf

Also notice that in order to extract the frustum you will need to extract it using model and view matrix as well otherwise you need to apply model and view transformation on the bounding boxes in order to perform the test.