Updating shadow map for a moving camera

Started by
2 comments, last by MJP 14 years, 2 months ago
In cases where a directional light is being used to cast shadows, if the camera is moving, the shadow map should be updated contain all the objects in view, while leaving the light's view angle unchanged. So should the view frustum of the light be adjusted to completely cover the space occupied by the frustum of the camera? If so, I would like to know how this process is usually carried out. I imagine constructing a box in which the camera frustum would fit, and then setting the light's position so its view frustum completely encloses the box. I don't know yet if there's a set of functions in DirectX that can set a view projection to enclose a box. For this approach, how much would this shadow map projection quality vary? Is it optimal for most angles or does it get really undesirable to apply for certain angles?
Electronic Meteor - My experiences with XNA and game development
Advertisement
I think you just need to play with the camera's positioning and coverage to find something that works for your scenes.

Also, most people use cascaded shadow maps, so you'll have a few cameras to place.

Nitpicking at your wording, maybe you realize this, but it's not strictly enough to only render objects in view into the shadow map - there may be objects out of view that cast shadows onto objects in view, and you'll want to draw those into the shadow map otherwise you'll see shadows from objects disappear
Yep, I'm aware that shadow casters should not be culled from the light's point of view if you want to get their shadows displaying correctly. However, I'm still trying to take this problem one step at a time and start from just optimizing the light's frustum without taking this in consideration.

That also goes as well for other shadowing techniques. I'm not sure if I'll be able to take on cascaded shadow mapping without this problem I'm trying to solve. Maybe part of the solution lies in another technique like parallel-split shadow mapping. I know that in most PSSM implementations the view frustum is dynamically adjusted as the camera changes position and orientation.

Quote:
I think you just need to play with the camera's positioning and coverage to find something that works for your scenes.


This is what I'm trying to figure out. How to set the camera and light so that the light's frustum would fit tightly into the camera's frustum (or its bounding box if that's easier).
Electronic Meteor - My experiences with XNA and game development
Fitting a bounding box to the view frustum is a typical approach. Lately it's also become common to use a bounding sphere, since with a sphere your orthographic projection parameters don't change when the camera rotates (changing the parameters will cause visible "jittering" at shadow edges).

This topic is closed to new replies.

Advertisement