Godot Version
Godot 4.3 stable
Question
I’ve a large open area at night, and I want to add many localized lights. The environment is mostly static.
Is there a way to bake the shadow map of each light, in a way that it doesn’t need to be recalculated on each frame since is unnecessary?
I just want to calculate a shadow map offline, store on disk, and reuse it each frame.
I’m aware of Lightmaps, but that seems to serve a different function.
Found this on the documentation:
Every frame, the following procedure is performed for all lights:
Check if the light is on a slot of the right size. If not, re-render it and move it to a larger/smaller slot.
Check if any object affecting the shadow map has changed. If it did, re-render the light.
If neither of the above has happened, nothing is done, and the shadow is left untouched.
So looks like Godot automatically decides to re render or not the shadow maps.
That optimization is always on.
Not sure what triggers the re render… If anyone knows where is that in the code please let me know.
Would be great if there is a way to force some object as static, so they don’t trigger a shadowmap refresh even if some small change happens.
Hi,
Lightmaps can be used to bake direct lighting including shadows. There is a property of light nodes called bake mode. When set to static the light is only calculated when baking the light map.
2 Likes