Shadow Mapping questions

Thanks in advance for any help or input-

  1. I have a “sun” casting shadows above a vast terrain. The problem lies when an object casts a shadows at the edge of the light frustum. This causes the shadow to “bleed” out forever. I have tried using GL_CLAMP on the depth texture with a GL_TEXTURE_BORDER_COLOR vector of either 1.0 and 0.0 and I still see the same effect. GL_REPEAT cause the shadow texture to be duplicated in patches across the terrain, which is not what I want. Is there any way to “stop the bleeding”?

  2. The other problem is when the light is directly overhead, the shadows disappear, even for objects clearly above the ground. The work as long as the light is not exactly at the x=0 y=0 point. I can move the light all over and everything shadows, but if the light is at x=0,y=0 the shadows disappear.

Any ideas? Thanks again for your help

Have you tried GL_CLAMP_TO_BORDER_ARB?

Thanks Ostsol - That was exactly what I was looking for…

I also resolved my second issue.

Everytime I renderered, I would regen the the lights view matrix with gluLookAt. I was passing an incorrect up vector(0,1,0) which went straigh back into the “lightcamera” when it was directly overhead.

Thanks again Ostsol - you saved me tons of frustration…


[This message has been edited by azcoder (edited 09-22-2003).]

Originally posted by Ostsol:
Have you tried GL_CLAMP_TO_BORDER_ARB?

I once read nvidia video cards will revert to software rasterization when this is used because it is not really supported in hardware.
This sounds strange to me butI would like to get a comment on that (possible) problem.

Thank you!

Obli, I believe that was indeed the case on GF2. GF3 and up support it in hardware.

– Tom