Large scale perspective lights casting shadow maps, in the most optimized way?
- by meds
I'm using projected texture shadows coupled with lights to light a large sports field at night. To do this I'm using shadow cameras which I place in the position of the stadiums lights and shine it down on the field at the appropriate angle.
The problem with this method is the textures to which I render the shadows into have to be very large so they can keep sufficient detail over the entire stadium.
This is incredibly under optimized since at any given point the players attention is only directed on a small portion of the field meaning large chunks of the texture just take up space wit no benefits.
However the issue is the lights need to be perspective based as they come from actual directional lights hovering over the stadium.
The way to solve this, I believe, is to figure out in the shadow cameras view matrix it would be to place the actual camera to render from, and adjust the view matrix accordingly to the position it is.
So my question is, how can I calculate the optimal position to put the shadow camera and calculate its view matrix such that the shadows it projects will appear to be coming from the light source rather than the camera?