# About view matrix and frustum culling

I was trying to determine if an object (sphere) is inside a view frustum. My strategy was first to get the view matrix:

glm::lookAt(cameraPosition, lookAtPosition, cameraUp);


Where cameraPosition is the position of the camera, lookAtPosition is calculate by cameraPosition + cameraDirection and cameraUp is pretty much self-explanatory.

After obtaining the view matrix, I calculate the 8 vertices of the frustum in the camera view, then multiply the inverse of the view matrix by each point to get the coordinate of them in the world space.

Using these 8 points in the world space, I can construct the 6 planes by using cross products (so their normals will point inward). Then I take the dot product of the object vector (I get the vector by subtracting the object position with an arbitrary point on that plane) with the normal vector of each plane, if it is positive for all 6, I know it's inside the frustum.

So my questions are:

• Is the camera view is always set at (0,0,0) and looking at the positive z direction?
• The view matrix transform the world view into the camera view, if I use the inverse of it to transform the camera view to the world view, is it correct?

My frustum is opposite with my cameraDirection which causes nothing to be seen on the screen (but it still drawing stuff in the back of my camera).