What is a typical set up for frustum culling?
I’ve looked at example codes but the culling is coming out wrong.
Chunks that shouldn’t be rendering are rendering and some aren’t rendering.
This is how I’m setting it up:
Matrix4f.mul(projMatrix, viewMatrix, combinedMatrix);
invProjViewMatrix.load(combinedMatrix);
invProjViewMatrix.invert();
frustum.update(invProjViewMatrix);
And I’m extracting the planes the typical way.
this is how I update my viewMatrix:
setIdentity();
rotate((float) Math.toRadians(camera.getPitch()), new Vector3f(1, 0, 0));
rotate((float) Math.toRadians(camera.getYaw()), new Vector3f(0, 1, 0));
Vector3f cameraPos = camera.getPosition();
translate(new Vector3f(-cameraPos.x, -cameraPos.y, -cameraPos.z));
What’s wrong?
EDIT: Heres what it looks like with me rotating the camera around: (It only renders wire mesh when its “outside” frustum. For debugging purposes.)
Big gif. Takes awhile to load.