Dynamic lighting and baking

So is there a way to bake the effects of a dynamic light somehow? In the project below none of the assets that have shadows move, so a dynamic light casts the long shadows on the ground like you’d expect. The static shadows just make little circles under the trees. Is there a way to get the long shadows from the dynamic shadows without having them actually be calculated in realtime if there’s never any movement (or just slow down the dynamic shadow calcs somehow) because the game looks bad without any of the longer shadows but the dynamic shadows that are for all purposes actually static kills about 30 fps.

with dynamic shadows


Surely if you make your sun light static and increase your ground lightmap resolutions you’ll get the same type of long shadows…

Stationary, not static. You really don’t want to use static light as your sun.

Yeah your right, used to arch viz style lighting, no need usually for a moving sun.

Both are non moving. Stationary has dynamic per pixel direct light calculations but baked shadow maps(at long range) and indirect lighting.

So do I leave the dynamic shadows set to on while the light is stationary or turn on dynamic indirect lighting? Turning off dynamic shadows on the stationary directional light results in the longer shadows disappearing. Any specifics in the project settings rendering?


Did you bake? All lights are considered dynamic until baked, so the dynamic shadow option will cause your shadows to disappear until then. Once it’s baked, the dynamic and static option will correlate to the objects that could be affected by the light. Unless the trees are skeletal meshes, set to moveable, or mesh particles, the dynamic per-object shadow from a Stationary Light isn’t needed(if performance is an issue). Since I assume the trees are waving in the wind, you’ll probably still want a dynamic shadow of sort, so try increasing the view distance for the Cascaded Shadow Map in the light properties. With that, you’ll get what Kalle is saying, dynamic shadows up close, that fade back to the non-moving static shadow at a distance - another performance benefit since we don’t need to see moving tree shadows really far away, if they were even distinguishable.

You could just make your assets that are never going to move stationary (not the light setting, the actor setting, like your Trees or whatever). Then the light would be set to Movable (dynamic). This is used in Fortnite as a way of optimizing dynamically lit scenes that have a lot of geometry that’s not really moving.

Read up on it and see if it’s a fit for your needs. I only read your initial post and wanted to share this feature you’re likely not aware of. Sorry if I missed something else you had posted in here.

Some other things you can look at too.

For the far shadows, you could enable Mesh Distance Fields and use RayTraced Soft Shadows:

This will give you the far shadows you want without having to bake the scene. Larger scene typically don’t work as well for baked lighting because of all the lightmaps that have be stored and packed into atlases and then you’re using your texture memory to load these all in when needed. This is why more open scenes use dynamic lighting instead of baked.

So if you opt to go with DF shadows, I would suggest using a mid-low-range value for the Dynamic Cascaded Shadow Maps distance (something in the 1500-2500) range so that you get nice sharp shadows, and when you enable Distance Field Shadows you get the mesh distance field representation at these farther distances.

Anyways, I hope that helps.

Yup, this is definitely the solution. Instead of losing 30 fps to the shadows now it’s 4 fps so huge improvement. Thanks, the performance hit of the moving foliage is huge.