Hello,
I’m working on a project with a terrain and top down camera in a fix angle.
There’s a directional light (like sun) casting shadows on the terrain.
For a big terrain I have to set a large shadow camera view (left-, right-, top-, bottom value) and for detailed shadows a big shadow map width, height. This will way heavy on the performance as far as i know. So it’s better to set a smaller view and smaller shadow map but then just a part of the terrain has shadows.
I know of the cascading shadow map solution but i thought of a other solution.
In the update loop i stick the directional light to the camera like this:
directionallight.target.position.set( camera.position.x, 0, camera.position.z ); //change target position to keep the same angle of the shadow;
directionallight.target.updateMatrixWorld(); //update the target… performance?
directionallight.position.set( camera.position.x, 0, camera.position.z ).add( 10, 10, 5 ); //the update the lights pos
After this implementation i only have to set the shadow camera view as big as the camera view. and when i move around the map there are always shadows. So, it works but my question is: is it a good idea/wise to do this? will it perform better?
Thanks for any answers/thoughts.
Edit: aka Screen Space Shadows