How to make static lights cast dynamic shadows?

I’m creating a dungeon-type level, and trying to light it with several point lights.
I can’t have everything be set to movable for performance reasons, so I’m trying to set all lights to static and every static mesh to static. However I also want dynamic things (like the player character) to cast dynamic shadows.
The lights settings have dynamic shadows enabled, but after I try to build the lighting some of them do not cast dynamic shadows (others do).
Sometimes when I build I get a message saying there is overlap. From a little research I found you can’t have more than 4 lights overlapping, could that be the problem? What exactly does that mean? Does it mean more than 4 lights can’t overlap the exact same spot, or does it mean one light can’t overlap with other 4 lights, even if the overlaps are in different spots?
Why does the message appear some of the times I build the lighting, but not always?
And finally, how can one light a dungeon-like level with such limitations? Would appreciate some tips.

It sounds like you’ve basically got it right, apart from the overlap. You can tell if you point lights are overlapping, because they will have a big red X on them.

Static Lights are simply baked lighting. These cannot cast dynamic shadows from moving objects. And movable objects are not included in the bake. You can set movable objects to be included into the bake (Lightmap Type Force Surface, was “Light as if static” before 4.19). But then, it will not create dynamic shadows, but instead while moving the object shadows and light will stay in place as in the baked maps - leads to problems. I just tested that now, because I never used it myself before. As said, If not using that option, movable objects will not be included in the bake for static lights at all.

So for the dynamic shadows from movable objects, you do need stationary lights. These are in between fully dynamic and static. These can cast dynamic shadows from moving objects. But as you found: the limitation is the overlap - as said, for stationary lights, you get that red X, if at any point, 4 or more stationary light bound volumes do overlap. But this is a warning, and it means, that the additional overlapping light(s) will now be switched to fully dynamic at performance cost - something you wanted to avoid. If you check the log, you’ll find messages like:

“PointLight4 Severe performance loss: Failed to allocate shadowmap channel for stationary light due to overlap - light will fall back to dynamic shadows!”

But actually, it should at least work (with performance impact). So it might be, that some of your lights are still static - in which case, no dynamic shadow gets cast.

Also note, that setting “Cast Dynamic Shadows” also requires to have set “Cast Shadows” on the light, as well as on the mesh, the “Dynamic Shadows” flag also requires the “Cast Shadow” flag to be set.

So for a dungeon, having quite some lights arranged in a line, you can have multiple of them - just make sure, the radius is set so that overlaps do not happen for more than 4 of them. The cost for dynamic shadowing part will still be there. Also, it could be useful to use for example spot lights, which are cheaper than point lights.

3 Likes

Your answer helped me a lot, thanks!