I render a shadow map to a GL_DEPTH_COMPONENT32F_NV texture. This texture is attached to a FBO without any color attachements.
I render the normal scene to a RGBA8 color Renderbuffer and a GL_DEPTH_COMPONENT32F_NV depth renderbuffer, both attached to a FBO, not the same as the one used for the creation of the depth map.
When the depth range is [0.0, 1.0] everything works (glDepthRangedNV called with (0.0, 1.0))
But as soon as I widen the depth range (with a call such as glDepthRangedNV (0.0, 10.0) for example), the shadow mapping doesn’t work anymore, the vector returned by shadow2DProj is uniform over all the fragment of the scene.
I’ve been searching the spec for 2 days, looking for the notion i’m missing but unsuccessfully!
glClearDepthdNV (10.0) called.
I called glClearDepthdNV and glDepthRangedNV almost everywhere: before, after FBO binding, every frame…
Both FBOs’ target is GL_RENDERBUFFER_EXT, but I use framebuffer_blit later in the rendering, but when it is called, the scene is already rendered into the 2nd FBO’s color attachment.
FBOs’ completeness is checked.
Depth map texture:
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
Using GLSL vertex and fragment shaders.
The sampler in the fragment is a sampler2DShadow.
Running on a GeForce 8800 GTS 640mo, ForceWare 158.22, WinXP SP2, all patches applied.
Double-Thanks, you’ve even read the details!