As some of you know, a while ago I implemented cascade shadow maps for one of the games I am working on.
They worked ok, but now I have added an auto zoom feature to my cameras they are totally broken.
Doing the zoom was easy, I just calculated a field of view that made the bounding box of the target fill a proportion of the screen.
What this effectively does is squeeze the view volume down from our traditional pyramid into a thin inverted spear.
To illustrate the problem, consider a camera 2 meters above the ground pointing horizontally along a flat plane.
The nearest visible point is easy to calculate.
float near = 2 / tan(FOV*0.5);
So for a 45 degree field of view it is 4.82842712 for a 22.5 degree field of view it is 10.05467, but for a 5 degree field of view it is 45.8075310
The effect of this is that the bit of the screen you are displaying gets pushed further down the depth buffer.
I fact when I modified my shader to just draw the homogeneous Z coord, all the values were greater than 0.9
Sadly I have a 16 bit display and a 16 bit depth buffer, neither has the accuracy to give me nice shadows.
So I'm looking for ideas again.
Anyone had this issue and come up with a solution?