I’m working on an OpenGL application and I’m having trouble with my objects being clipped undesirably by frustum culling
The scene consists of a number of objects on an invisible plane. You can pan around by left clicking and dragging on the invisible plane (This does not translate the plane, it translates the camera). You can rotate the invisible plane by right clicking and dragging (This rotates the plane).
The problem comes when you rotate the plane and then pan so that the objects pass through the far plane of the frustum.
I would like my objects to never get clipped, no matter how far back you push them.
but I was thinking perhaps I could update the projection matrix and frustum every frame, ensuring that the near plane touches the front of the bounding box of my objects and the far plane touches the back of the bounding box of my objects.
Does anyone have any advice which could help me get rid of this unwanted clipping?
Or, if you’re only real problem is far clipping, you could push your far clip back enough that you’ll in practice never hit that distance. Just make sure you push your near clip out as far as you can. In fact, there’s a form of the projection matrix for an “infinite distance far clip” that in practice eliminates far Z clipping, though you sacrifice some depth precision for that.
If you end up needing to render a Z range that is just too large for standard depth buffers, you can use higher precision depth buffers and/or render the Z range in depth slices (depth partitioning).