// Initialize depth texture (my texture loader, basically sets the passed params)
if (!glTex::UseTex(NULL, DepthSize, DepthSize, TexDepth, GL_DEPTH_COMPONENT, GL_LINEAR_MIPMAP_LINEAR, GL_CLAMP_TO_EDGE)) return false;
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE, GL_ALPHA);
// Update depth texture
glBindTexture(GL_TEXTURE_2D, TexDepth);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, DepthSize, DepthSize);
// Snap shadow map
SnapDepth(TexDepth);
// Go to reflective object position and snap cubemap
glLoadTransposeMatrixd((double*)RefObjMat);
SnapCubemap(TexCubemap);
// Draw objects (bright light)
glLoadTransposeMatrixd((double*)CameraViewMat);
glAlphaFunc(GL_GEQUAL, 0.01f);
glEnable(GL_ALPHA_TEST);
DrawObjects();
glDisable(GL_ALPHA_TEST);
// Draw objects (dim light)
glDepthFunc(GL_LESS);
glLoadTransposeMatrixd((double*)CameraViewMat);
DrawObjects(3);
glDepthFunc(GL_LEQUAL);
First image is camera view, second is light view. Object is a concave mirror. In camera view, you can see the weird bright strip between 2 shadowed parts. That is between shadow due to lighting model (opposite side to light) and shadow due to shadow mapping (self-shadowing). Reversing bright/dark render order didn't change anything regarding that strip. I guess that the reason for it is either imprecision (512*512 depth map, maybe 2K*2K could fix that, but that's too big), or polygon offset (moving shadow back a bit). I can't remove polygon offset because then whole scene would be Z-fighting. Any ideas how to fix it, leaving the mirror completely flat? (A solution is making it a shape with volume, but that's not what I want) P.S. shadow looks rather ugly, any way to improve that without using shaders? (OpenGL 1.4 only). I know nVidia has some kind of PCF built in and enabled through GL_LINEAR filter, but it doesn't seem to work on ATi. Thanks in advance!