Directional light (sun) as dynamic or static or stationary

Which one settings is better and why for the sun? I saw people set stationary or dynamic but don’t know why. What is better for performance, and quality and how much it affects.

It has to be dynamic for a day/night cycle system, or to change properties in run-time (in-game). But stationary seems to provide the most options for shadowing with efficiency, though is primarily hampered in its versatility by a number of flaws / limitations…that apparently can be fixed using a number of methods. The problem with a static directional for sun is its stuck in the same position during game, and it doesn’t allow cascaded shadow maps, which have the worst consistency anyway. However, static directional is highly efficient to run after proper light building, and has a global illumination control factor in the post process volume that is useful (stationary does too), and by efficient I mean you don’t lose a ton of memory / processing speed. Yet it depends on the number and kinds of objects rendering in the scene too, and how those need to be lit / changed at runtime. I suggest trying dynamic directional with stationary skylight, forget about distance field ambient occlusion and simply use the PPV’s (post process volume) screen space AO, and utilize the sky atmosphere and exponential height fog to do sky effects / lighting color changes, etc. It’s just a suggestion though, so do not quote me on it as I’m a beginner too and haven’t finished an entire scene in my whole time exploring and learning Unreal yet.

Static: Unless you’re very performance constrained you probably don’t want a static directional light, because they won’t cast dynamic shadows (though I think capsule shadows will work)
Stationary: Ideal in situations where the sun doesn’t need to move, because they provide both baked indirect lighting and dynamic shadows. Best quality of all your options.
Movable: Necessary when you need the sun to move. The worst quality of the 3, you won’t get any baked indirect lighting from this.

You can have a stationary sunlight if you’re willing to accept that the shadows won’t move. This is what was used in Borderlands 3. You’ll probably also have to tone down the indirect lighting intensity, otherwise it will look weird at night.

1 Like

Thank you both of you. I have better perception about this question.

Could you also please tell me, if I set it to static/stationary, it requires to build lighting, and when I do build lighting it takes forever to build, especially if I have a lot of foliage in my level. Is that okay, or I’m doing something wrong?
And my setup is not bad, maybe not the best but it’s quite good. Compiling and other heavy calculations don’t take too much time.

Lightmass has to precompute the indirect lighting when working with static/stationary lights, it takes a while but it is what produces the nice bounce lighting.

For foliage you’ll probably want to disable static shadows and set the lightmap type to “Force Volumetric”. It’ll build lighting much faster, and surface lightmaps don’t work well on foliage anyway so you’re better off just using the volumetric lightmap.