Original Post
I was originally using a standard right-handed projection matrix. Objects beyond the far plane would be clipped from view, naturally.
But in order to support stencil shadows I have switched to an infinite projection matrix and objects beyond the far plane of the camera are no longer clipped. Instead of melting into the scene as they become visible in the distance, they magically appear as soon as their bounding boxes touch the far plane.
#1:
I wanted to fix this by clearing the depth buffer to the appropriate depth so that, in the infinite view, things would melt onto the scene the same way as they did in the standard view.
How do I calculate the appropriate depth value within the context of the infinite projection that corresponds to the value of 1.0f in the standard view projection?
#2:
But can I do this? Won’t this mess up my stencil shadows?
#3:
Then what should I do to fix the far-plane depth?
Yogurt Emperor
But in order to support stencil shadows I have switched to an infinite projection matrix and objects beyond the far plane of the camera are no longer clipped. Instead of melting into the scene as they become visible in the distance, they magically appear as soon as their bounding boxes touch the far plane.
#1:
I wanted to fix this by clearing the depth buffer to the appropriate depth so that, in the infinite view, things would melt onto the scene the same way as they did in the standard view.
How do I calculate the appropriate depth value within the context of the infinite projection that corresponds to the value of 1.0f in the standard view projection?
#2:
But can I do this? Won’t this mess up my stencil shadows?
#3:
Then what should I do to fix the far-plane depth?
Yogurt Emperor