Shadow Mapping Projection Question

Quick question, I have shadow mapping working fine. But I decided to make my projection matrix for the light orhto. Of course my light didnt scale smaller or bigger as the light moves back and forth. But I noticed that I lost my shadows.

My question is that if I dont have my prespective projection in does that mess up my R compare in the GL_TEXTURE_COMPARE_FUNC_ARB. Something to do with the r/q? Perspective projection always throws my brain for a loop:)

Any help would be fantastic. I’d like to know if Im on the right track.

Troy

My question is that if I dont have my prespective projection in does that mess up my R compare in the GL_TEXTURE_COMPARE_FUNC_ARB.
o perspective orthogonal, its all the same dif, both genrerate depth values, the only dif typically is with perspective things appear smaller the larger that depth value is

I understand what perspective projection works. I cant seem to figure out why changing my projection to orthonormal would cause my shadowmap shadows not to work

I cant seem to figure out why changing my projection to orthonormal would cause my shadowmap shadows not to work
most likely cause either
A/ the shadowcasters are not in the frustum
B/ the shadow recievers are not in frustum
C/ both A+B

the best way to see this is to draw the ortho projection frsutum onscreen to see which area is inside the shadow frustum

Yea I am. I got a teapot and a ground and the projected texture (the lights color texture) projects through and no shadow happens. It seems like the compare doesnt work in orhto mode. I don’t know what would be the cause of it. I switch back to perspective projection and its fine.

Ortho should work but your z buffer values need to match the distance from light along the r axis (or the equivalent for however you are implementing this).

Make sure you’re not screwing this up with a texgen coefficient or texture z translate that mover your ortho z ® into the wrong place. This is the most likely cause of your problem.

Are you multiplying an ortho matrix onto your texture stack or just doing this yourself with vertex programs mapping coords directly to texture? Again make sure z and r are compatible.

Zed, receivers don’t need to be in the shadow rendering. In fact this can help reduce artifacts.

In troubleshooting Shadow Mapping, I have found that sometimes it helps to invert the Shadow Map e.g.:

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_COMPARE_FUNC_ARB,GL_GEQUAL);

instead of
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_COMPARE_FUNC_ARB,GL_LEQUAL);

In this case, anything NOT in shadow renders black, and shadowed renders as regular. Also, remember to CLAMP_TO_BORDER to prevent the texture from bleeding.

BTW, an Ortho projection will work.

Originally posted by dorbie:
Zed, receivers don’t need to be in the shadow rendering. In fact this can help reduce artifacts.
true for shadowcast, i was talking about the pass when u draw the shadows ‘into’ the scene (then again i might just be overcomplicating things :slight_smile: )anyways the best way is like i said
to draw the ortho projection frsutum onscreen