Static Lights are NOT free, and have many dynamic calculations?

I’m a tech artist at an indie studio. When using Unreal Insights to address various issues of our project, I came across a “thing” which made me feel very uncanny. Whether this is a bug, a quirk of the engine, or my personal mislead, you decide (and maybe tell me)…

So. What Epic tell us and everyone knows: static lights are basically “free”. That is to say, they have no direct PERFORMANCE cost, they don’t calculate any real-time shadows, and their only impact is memory and loading the lightmaps. What I found out, using Unreal Insights, is that this is NOT the case.

What I did, was make a few “Developer” builds of a clean project:

  1. Made a clean, standard unreal project. Got together a simple scene, with some meshes, trees, directional and skylight (both static). I put around 200 point lights and spot lights. All set to STATIC. (And I even did an additional test where I unchecked “Cast Dynamic Shadows” though it isn’t necessary to do so if the light is static). I bake the lighting.
    I took Unreal Insights, and played the build, just moving my head around. This is what is shows, when measuring a 10second segment.
    image
    Inclusive time of different shadow calculations for 10seconds is around 1.6 second

  2. Now, I make another developer build. This time, everything is the same, but after I bake the lighting, I delete all the point and spot lights. (or, in my case, I just make a sublevel, which isn’t streamed at runtime). So the idea is, that AFTER the light is built, all the lights must be gone.
    And this is what UnrealInsights shows when taking in another chunk of 10 seconds.
    image
    Inclusive time of different shadow calculations for 10seconds is around 53 ms


There was also a slight difference in FPS. Where static point lights were present, fps was around 230. Where they were deleted or not loaded, FPS was around 240.
Mind you, this was a VERY SIMPLE test scene on a clean project. Think of what happens on a complex project? Our game’s village has thousands of meshes, foliage, and many hundreds of static lights. All of which hindered performance until I made them unload at runtime.

Tech details:

  • UE 4.26.2 & 4.27.2, downloaded from launcher. (NOT source-built).
  • Occurs in both Deferred Renderer and Forward Shading.
  • No checkboxes (like cast dynamic shadows) are influencing anything.
  • If light intensity is set to 0 - then the light doesn’t contribute to performance impact.
  • Packaging was done for “Developer”, Win64.

Thought I’d share this. Any thoughts on the subject are welcome. You can reproduce the scenario very easily on your own. Maybe I’m not getting something? But to me, this looks like a major thing. Considering everything that is said regarding static light zero performance impact.

2 Likes

What I’m guessing is, that ‘Cast Dynamic Shadows’ tickbox isn’t right somehow.

As you probably know, static lights do project dynamic light for anything that the engine thinks is moveable.

This is true for stationary lights, not static lights. Static lights bake all of their lighting down to lightmaps.

Ah, good point… Never used totally static much, because of its totally restrictive nature… :slight_smile:

Found a tick in Project Settings - “No Preview Shadows in build” or something. No effect whatsoever. There are still some dynamic calculations going on…


and this is how the scene looks like, if any1 is wondering… Very basic. Pretty much everything is default, and the project is standard, with no exotic settings.