Directional Light World Position for Shadow Maps ?

Started by
3 comments, last by Rompa 15 years, 8 months ago
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
Advertisement
Is this a dumb question?
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;
Hm, crosspost. I gave a somewhat better (IMO) solution in the other thread.
Million-to-one chances occur nine times out of ten!
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.

This topic is closed to new replies.

Advertisement