Sign in to follow this  

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

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this