Hi,
I've implemented Occlusion culling by selecting a number of big occluders and extracting planes from their AABB, forming an occlusion volume. In principe this works, but the thing is that the near plane(s) I'm using have a ‘d’ based on the front of the occluder instead of the back, meaning that the intended culling only happens when the camera is super close to the near plane(s). I've added some screenshots to illustrate:
- view before constructing the debug drawn edges of the planes
- hiding the occluder’s meshrenderer and debug draw the 5 planes (in this specific case)
- moving closer to the near plane, stuff gets occluded
- moving to almost the exact edge of the near plane
- occluder planes visualized (the edges), pDebugPoints in the code
This is the code I'm using: https://pastebin.com/DkdaGAx2.
I'm basically trying to find a way to let the near plane(s) distance (plane.d) be based on the rear of the occluder instead of the front. Any ideas on how I could achieve that?