Dynamic shadow mapping- how to update the light's position

This topic is 3163 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Given the 8 corners of a camera's view frustum and the desired view direction of a light source (defined as a vector), what is a good way to calculate the view projection of a light in order to cover the entire camera frustum? I want a light's view frustum to always enclose the camera's view frustum completely, so that a projected shadow map always covers the entire view. As of now I can only render shadow maps with fixed-position lights. [Edited by - JustChris on February 19, 2010 11:42:36 PM]

Share on other sites
Not sure off hand but if nobody else helps you out, you might look at how cube maps work or how people capture images for sky boxes from 3d rendered scenes (:

Share on other sites
I guess for cube maps, are you referring to a way to project a shadow map into a cube texture? I am just using one render target to make the shadow map.

As an example, let's say there is a camera looking just behind a character in third person view. When the character runs, the camera follows behind it. In an outdoor scene, there would be a shadows cast by a directional light (the sun), but for optimization purposes you would have the light only cast shadows over the viewable area. So as the character runs, the light needs to "follow" it with the camera by changing its position but keeping its angle. I hope that makes more sense. It seems to be a basic problem that needs to be solved for dynamic shadow mapping, but it's still not clear to me what I should be searching for.

Share on other sites
One method is to find the sphere which bounds those 8 points, centred at the camera's pivot point (the bit it rotates around).
Then place the light's centre at pivot - direction*radius, and make the projection wide/tall/deep enough to encompass the diameter of the sphere.
Instead of the camera's pivot, you could also use the mid-point of the 8 corners.

Share on other sites
Thanks, I will try both those approaches and see which one will turn out better for me.

1. 1
Rutin
33
2. 2
3. 3
4. 4
5. 5

• 11
• 13
• 86
• 11
• 10
• Forum Statistics

• Total Topics
632972
• Total Posts
3009609
• Who's Online (See full list)

There are no registered users currently online

×