clipping planes optimization for shadow mapping ?


could someone give me a sample code or at leat an idea to accurate my near and far clipping plane.

I’m working on a standard shadow mapping method. And I’d like these planes to come close to nearest and farest objects.
To improve my Zbuffer’s precision.

I’ve heard about reading again the zbuffer at frame-1 ?! Is that very accurate ?!! What do you think about it ?!!

What else could I do ??!!

thanks everybody for your help.

Emmanuel Quentric

i also ran into this problem. The only solution i could find was to use
which unfortunately is supported only by nvidia.
Hopefully Ati will include such an extension too…


thanks penetrator for your help.
Your idea seems interesting.
I’ve read explanations about depth_clamp.

It disables far and near clip planes, which fits my problem.
But it interpolates the zbuffer between the clipping planes values, and does a clamping if necessary.

I don’t need to interpolate the zbuffer, but I would like to keep the closest and farthest Z values as clipping planes.

Is there a “secret” value such as 0 for far and clip plane to prevent from interpolating the Zbuffer ? How to keep the closest and farthest Z as clipping planes ??!!