Visible stationnary shadows on distant objects


How to keep clean and visible stationnary shadows on movable objects whatever the distance of the camera (I have to be very close to see those shadows otherwise they disappear…)

My scene has both static and stationnary objets. When the light is stationnary, static objetcs do not get shadows baked. My answer to this problem is to duplicate the direct light and set the duplicated one to static. So i have both baked and stationnary shadows. But I do not know if it’s the right way to do this. it doesn’t seem to be ressource greedy though.

Thank you !

That’s a great application of directional lights for baked and stationary shadows, I think. It has the potential for problems when needing to change the lighting / shadowing real-time, where if the stationary object moves or is changed during run-time, then the static part of its lighting is going to remain the same, so would yield undesired results. That’s an inherent issue with dynamic vs. baked lighting when combining the two in certain ways. Stationary shadows shouldn’t disappear if using proper CSM settings (Cascaded Shadow Mapping), but it could also be an LOD problem. If there’s more than 1 LOD, or if the 1 LOD there is, has a short distance in which those quality shadows are rendered, then it could be the problem. CSM can be set to a long total distance, with somewhat wide transition areas. Try posting a pic or two of the issue, or a video, and the settings for the two directional lights.


Thanks presto423.

It works now but need to be tweaked a bit so I get same shadow color / transparency for both lights (on the following picture, left doors are baked with the static lighting, right doors are dynamic shadows on movable objects)

edit : it works nicely when game simulation is launched in the editor viewport but not in the standalone game (in this mode, shadows keep disappearing too fast)

My set sup is the following :

Directional light 1 set as static and used as sun for lighting and atmosphere. No CSM here obviously.
Directional light 2 set as static, not used for sun and atmosphere. CSM as follow :


Distance shadow view is quite acceptable with these settings.
How to change the greyed “Dynamic shadow Distance MovableLight” value ? (if needed)

To change the greyed out “Dynamic Shadow Distance MovableLight”, the directional light needs to be set to movable (dynamic), not stationary or static. Is the 2nd directional light stationary? I don’t see how it could have CSM if it’s static…though it could be due to an update or something.

The door on the right looks much better, overall. The distribution exponent seems rather high. It might be resulting in the popping of shadows. With 4 cascades and the distribution of those cascades set closer to the camera (exponent 4, or larger exponents), the first cascade is smaller in distance than the next cascade, and the 2nd cascade is smaller than the next cascade, and so forth. So a 30% transition region isn’t much for the 1st cascade, or probably the 2nd cascade too. I’d set the distribution exponent to 1 or 2 at the most, and try it at lower than 1 to see how it is. If that’s not it, there’s a problem I encountered when setting the Dynamic Shadow Distance Stationary Light, where once I got to the upper limit (right where the far shadow starts), the shadows would turn off entirely. I had to extend the shadow distance value of the light to 50,000 or so it wouldn’t turn the shadows off at those distances within 50,000.

One light light is static (used for sun and shadow bakings), the other is stationary.

You are right, the doors on the right look less dull.

I’ll try to apply your settings to see what happens :wink:

I just changed some settings in the sunsky actor’s directional light and skylight to be similar to yours, except with the exponent and fadeout fraction reduced a ton. I also added a directional light, and gave it similar settings to those. Before I changed the sunsky lights’ settings, the cascade transitions were horrible. It basically resulted in a visible shadow, while backing up and zooming in with the camera, lasting for about half a cascade distance. When I changed the sunsky lights’ settings, and set far shadow to 1 and 100,000 max range, the shadow stayed the same for the entire distance from next to it with the camera to the 50,000 shadow distance stationary light. I think with 2 directional lights (1 in the sunsky actor, and 1 separate), the cascades’ transition areas aren’t noticeable after baking if the exponent is set so cascades are distributed closer to the camera. This is getting rather complex, so I’ll stop for now. DFAO is on, but mesh distance fields are off.