Dynamic light performance in a Procedural Game (4 lights - 50 FPS?)

Hello guys, we need help.
I have a mayor issue with the lighting pipeline of Unreal, when it comes to lighting with movable lights. I have been stuck on this for maybe 2 years now, and never found a solution.

In this game world, houses get randomly spawned on a map, and each house needs about 4 - 5 dynamic lights. They can’t be static, or stationary, because light is not baked in this game, due to level streaming and for the ability tu turn them on and off.

Some points here and there:

  • They need to be shadow casters, otherwise their light clips out of the house and into other rooms.
  • Their attentuation radius, needs to be larger to light up the whole room, otherwise corners of the room stay dark.
  • I can’t place more smaller lights instead, because it doesn’t really make any difference - room with 4 smaller lights vs. room with 1 large light = same performace.
  • Larger lights are already spotlights.
  • I can’t make the attentuation radius smaller, and use post process effect, like exposure instead - the external environment has weather that the player needs to see, such as skylight effects.
  • If I set r.shadowquality from 1 to 4, makes pretty much no difference on the performance, except for 0, where it goes from 50 FPS to 110 FPS. Though, shadows are off.
  • If I set shadow resolution and other settings inside of the light, makes pretty much no difference.
  • The scene is pretty low poly, nothing too crazy, about 1000 draw calls and 500k triangles drawn.
  • I could turn the lights off upstairs when the player is for example downstairs, though still at least 3 lights would have to be active, -40 FPS anyway.

Basically, if I add one light into the scene, which a room in a hut with few models, it eats 15 FPS away. How is that possible?
The card is GTX 970, 12 core intel, etc etc.

The room, for illustration looks like this:

The only solution that came into my mind, is for the light to stop updating it’s shadow maps every frame. I searched around a bit, and found about 3 posts where Unreal developers are stating that this would be actually a solution.
“Each movable light should cache its shadowmaps as long as it isn’t moving. We could even separate static objects from ones that are moving and re-rendering the moving ones every frame, that way the ‘locking’ is automatic.” Such as here:
https://answers.unrealengine.com/que…r-movable.html

We have a programmer on the team, is there a possibility to change that in-engine? I am more of a tech art myself so I wouldn’t be sure. We build from source. Or any docs avalaible somewhere?

Thanks so much for any input.
Pavel

Hey Pavel,

Unreal already has a shadow map caching system for dynamic lighting, check here: https://docs.unrealengine.com/en-US/Engine/Rendering/LightingAndShadows/LightMobility/DynamicLights/index.html.

Are you 100% sure you’re bound to the shadow calculation?

Thank you for the reply. I just found out, that on my notebook which has RTX 2070 the game runs on 100 FPS no problem… So apparently the 970 is weaker than mobile RTX 1070… but on the charts it doesn’t seem like it, so I am wondering if there is some other bottle neck that I am not aware off…

Oh! And thanks for the link. I completely slipped through my search pattern. No idea how.

Also, how do I see if I am bound to a shadow calculation?

It’s probably an issue with the GTX 970 card and frame rate. An older card such as that is probably far less capable of consistently outputting 100 or higher FPS via HDMI 2.0+ if it’s utilizing graphics techniques with newest versions of Unreal, or perhaps even earlier versions (4.22 and lower). Is the level(s) using ambient occlusion? any ray tracing involved?

a 1080ti has trouble keeping up with epic setrings on a default scene with 1 dynamic (directional) light, so if you have 4…

Anyway, the cost can be imagined as.

of triangles (the light affects) * number of lights.

More meshes = more triangles = lower performance.
more dynamic lights = more meshes = lower performance.

Next engine version - we all hope - you’ll be able to use the skylight because you can re-capture it with a dynamic daycare without a hangup.
So, to make the interior scene light up properly you have multiple ways.

  1. a light portal. This helps but isnt necessarly going to fix it all.
  2. a skylight. This definitely helps. But it needs to work in tandem with the rest of the lighting.
  3. a post process.
    this is ideal because you can isolate the interior and make it so that the light is to taste. Also you can use the auto exposure setting to force a stronger eye adaptation value. Which may be needed at times.
    still the setting is isolated to within the house and will be disabled when walking outside.

Obviously this has its own issues. looking outside an open window may render weird.

Hope that helps.
I’m my testing, moving lights further away from clutter helped performance when you get to 6 or even 12 lights in an enclosed environment.
Obviouly we still need clutter and items. So the best way to include them is to make sure the modeling is as low poly as possible.
if something doesn’t move, Marge iMargewhatever they are on, eliminating some faces.
Actor merge can help in those situations too.

Yeah I’ve done some checks with RenderDoc and the shadow map caching works pretty well.

You can use the various stats to see where your frame time is spent the most. Commands like stat SceneRendering, stat GPU, stat LightRendering and so on.

Simple fix: Lower your light radius (Not brightness, radius), It will compute less shadow casters therefore improving framerate, you should get an extra bit of fps out of this.