Optimize 3D shadows for very large scenes?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Zylann
:warning: Old Version Published before Godot 3 was released.

I have a 3D game with a large amount of procedurally generated geometry in the scene, so if I enable dynamic sunlight shadows, it halves FPS because the engine has to render the scene twice (for the shadow map).

However, sunlight moves very slowly, so I think the shadow map should not be recalculated on every frame, right? Can we “bake” them while the game runs and ask to update manually?
Also, only a small portion of close-range elements could be updated quicker than elements that are far away.

Which are possible shadow optimizations for large scenes in Godot?

:bust_in_silhouette: Reply From: volzhs

There is a way to use baked light instead of using realtime shadow.
see this to know how to do it.

This will make shadow looks better and increase performance,
but it’ will make scn file very large.

You have multiple options to optimize realtime shadow rendering.

Setting Max Distance of DirectionalLight, instead of 0 value.
This will make shadow looks better and increase performance for large scene.

Turning off Cast Shadow of terrain mesh.
This is on by default.

Setting Shadow Filter to none at Scene > Project Settings > Rasterizer.
Try another options of shadow filter. :slight_smile: