• Advertisement
Sign in to follow this  

Directional Light World Position for Shadow Maps ?

This topic is 3551 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

Assuming I want a "Sun" in my Level. I have to create a modelview matrix for the camera, thus i need to put the light at a position. Where do i place it? thanks

Share this post


Link to post
Share on other sites
Advertisement
directional lights have no position.
but for your shadowmap u have to focus somewhere
perhaps something like

shadowmap_focus_pos = camera_position + camera_forward_dir*100

+ then u wanna add the suns direcion to that

sun_pos = shadowmap_focus_pos + sun_dir*100;

Share this post


Link to post
Share on other sites
If you use an orthographic projection for generating your shadow map (it is a DIRECTIONAL light after all), you can place the light pretty much anywhere. Assuming you're storing depth in your shadow map, its best to maximise the precision and place the "shadow light" as close as possible to the occluding geometry. You could use bounding boxes or sphere of the occluders in light space and then simply take the minimum bounds value and place your light there, which is the same as leaving the light where it is (at the origin in light space) and translating the objects closer with the model->world->light transform which you'd have to use anyway.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement