PDA

View Full Version : Depth Clamping problem



mikeman
02-03-2004, 08:30 AM
I am using the DEPTH_CLAMP_NV extension to implement depth-fail stencil shadows in GFX5200.I just add one line of code:
glEnable(GL_DEPTH_CLAMP_NV);

The problem is that it seems to ignore only the near clipping plane and it stills clip geometry against the far plane,so i get shadowing artifacts.
What am i doing wrong?

NitroGL
02-03-2004, 08:33 AM
Use an infinite far plane?

mikeman
02-03-2004, 08:50 AM
If i use an infinite far plane,then i don't need DEPTH_CLAMP.
The spec says that,when using DEPTH_CLAMP,near and far planes are ignored.
Why my program keeps clipping in far plane?

jeremyz
02-03-2004, 09:07 AM
Are you using w=0 to project to infinity for
the far clipping plane?

mikeman
02-03-2004, 09:16 AM
Ok,I figured out what was happening.
DEPTH_CLAMP_NV ignores near and far clipping planes,even if the far plane is in finite distance from the eye.Every object beyond the far plane is drawn but the z-value is clamped to 1.0. I used glClearDepth(1.0) and glDepthFunc(GL_LESS),so the fragments of these object were eliminated by the depth test,not by clipping.When i used GL_LEQUAL,the program ignores both the near and the far plane(although,of course no depth testing is possible beyond the far plane).