View Full Version : Shadow Mapping

05-09-2004, 05:14 AM
I have implemented shadow mapping in my outdoor terrain application. It works fine, except the shadow map doesn't cover everything. Since the light frustum is finite, it doesn't cover the entire view frustum.

The net result is everything looks great when I am in the center of the map, but the shadows disappear as a move too far.

Right now I have a single light high overhead, and it looks to the center of the terrain with an Ortho projection.

How is this typically handled in an outdoor scene? Should I move where the light so that it looks toward the center of the view frustum as I move the camera?

I have begun attempting to implement a perspective shadow map, and that approach looks like it might help some of the aliasing issues, but I am still confused about the coverage issue.

Thanks in advance for any help....

05-09-2004, 05:38 AM
Translating the light (both source and destination) along the camera may be enough.

05-09-2004, 08:41 AM
If the light is directional, you don't translate the light, but you translate the frustum.

The absolutely simplest way to do a shadow map is to create an orthogonal frustum (rectilinear block) that covers the viewing frustum as projected at ground level. Then skew or rotate this frustum such that its "up" points in the same direction as the light's source vector; skewing is easier.

Note that this frustum will move around when the viewing frustum (i e, camera) moves around, and thus will always cover the area in front of the camera. As long as you use the same frustum when rendering the shadow map as when texturing with the shadow map, it'll work fine (but obviously, you need to re-generate the map each step the camera moves).