Jump to content
  • Advertisement
Sign in to follow this  
JustChris

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.

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
Advertisement
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 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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!