# Optimizing many dynamic light sources in UE 5.4

**URL:** <https://forums.unrealengine.com/t/optimizing-many-dynamic-light-sources-in-ue-5-4/1941916>\
**Category:** Rendering\
**Tags:** unreal-engine, question\
**Created:** [July 18, 2024, 2:35pm UTC](https://forums.unrealengine.com/t/optimizing-many-dynamic-light-sources-in-ue-5-4/1941916 "2024-07-18T14:35:21Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gamefel](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gamefel](https://forums.unrealengine.com/u/Gamefel)\
**Post date:** [July 18, 2024, 2:35pm UTC](https://forums.unrealengine.com/t/optimizing-many-dynamic-light-sources-in-ue-5-4/1941916/1 "2024-07-18T14:35:21Z")

</div>

How are you guys optimizing many dynamic light sources (e.g. in a large open world)? I did some testing and the shadows are responsible for killing the performance. So what would be good practice/your ways of tackling that performance issue? Working with Virtual Shadow Maps and Lumen.

---

<div class="post-metadata">

**Author:** ![WorldFilmsStudio](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@WorldFilmsStudio](https://forums.unrealengine.com/u/WorldFilmsStudio)\
**Post date:** [July 18, 2024, 3:04pm UTC](https://forums.unrealengine.com/t/optimizing-many-dynamic-light-sources-in-ue-5-4/1941916/2 "2024-07-18T15:04:48Z")

</div>

(in Project Settings)  
-Shadow Map Method: Shadow Maps  
-Global Illumination Method: None  
Try these while working on your project, when you do r.ForceLOD 0 it will also give you a lot of performance (if you have many static meshes like trees), disabling shadows completely when working in regions of your map with a lot of trees or other foliage can also help ouf a lot

---

<div class="post-metadata">

**Author:** ![jblackwell](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jblackwell](https://forums.unrealengine.com/u/jblackwell)\
**Post date:** [July 18, 2024, 6:36pm UTC](https://forums.unrealengine.com/t/optimizing-many-dynamic-light-sources-in-ue-5-4/1941916/3 "2024-07-18T18:36:23Z")

</div>

That in part depends on what shadowing method you’re using. Traditional shadowmaps, VSMs, DF shadows, screen traces, some combination thereof?

If you’re using VSMs, one of your main priorities needs to be making sure every single object that’s being shadowed is nanite. Non-nanite geo is very expensive for the pipeline and will utterly kill perf.

---

<div class="post-metadata">

**Author:** ![glitchered](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/glitchered/32/768299_2.png) [@glitchered](https://forums.unrealengine.com/u/glitchered)\
**Post date:** [July 18, 2024, 6:59pm UTC](https://forums.unrealengine.com/t/optimizing-many-dynamic-light-sources-in-ue-5-4/1941916/4 "2024-07-18T18:59:48Z")

</div>

in raytracing you have r.manylights. it’s beta tho. in a “regular” world you gotta make compromises. disable shadows where you don’t need them. use ambient lighting to avoid having too many lights to get the scene bright enough. avoid light overlap as much as possible. attenuation radius down to necessary ranges. avoid every unnecessary piece of computation.

---

<div class="post-metadata">

**Author:** ![Gamefel](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gamefel](https://forums.unrealengine.com/u/Gamefel)\
**Post date:** [July 19, 2024, 6:56am UTC](https://forums.unrealengine.com/t/optimizing-many-dynamic-light-sources-in-ue-5-4/1941916/5 "2024-07-19T06:56:28Z")

</div>

Thanks! Setting the attenuation radius to prevent overlapping is quite tricky for me, since I cant predict where the player is building a lightsource (e.g. a torch). Are there any good practices what to do in that case?

Also what does ambient light refer to in that context? Like a cubemap that does slightly light everything?

---

<div class="post-metadata">

**Author:** ![Gamefel](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gamefel](https://forums.unrealengine.com/u/Gamefel)\
**Post date:** [July 19, 2024, 6:58am UTC](https://forums.unrealengine.com/t/optimizing-many-dynamic-light-sources-in-ue-5-4/1941916/6 "2024-07-19T06:58:05Z")

</div>

Thank you! Yes, I am working with VSM. I updated my post! I Already checked that, and everything is nanite. But still I am wondering how I can bring down the performance cost even further.

---

<div class="post-metadata">

**Author:** ![BananableOffense](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BananableOffense](https://forums.unrealengine.com/u/BananableOffense)\
**Post date:** [July 19, 2024, 5:56pm UTC](https://forums.unrealengine.com/t/optimizing-many-dynamic-light-sources-in-ue-5-4/1941916/7 "2024-07-19T17:56:05Z")

</div>

If it’s player built then you can either prevent them from placing light sources too close together, or allow them to negatively impact their own performance by not restricting this in any way.  
Perhaps if you display the radius in game when placing a light players would naturally avoid overlapping them to an extent.

---

<div class="post-metadata">

**Author:** ![glitchered](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/glitchered/32/768299_2.png) [@glitchered](https://forums.unrealengine.com/u/glitchered)\
**Post date:** [July 19, 2024, 6:36pm UTC](https://forums.unrealengine.com/t/optimizing-many-dynamic-light-sources-in-ue-5-4/1941916/8 "2024-07-19T18:36:50Z")

</div>

hmm. this is pretty deep engine optimization. if the world is build by the player you may want to have a hybrid render that can bake dense shadows into static shadow "light"maps and you may want to combine dense lighting into irradiance volumes. doing this on the fly is a pretty gnarly technique. will need a fair amount of computation on the user’s device.

---

<div class="post-metadata">

**Author:** ![RecourseDesign](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/recoursedesign/32/1194503_2.png) [@RecourseDesign](https://forums.unrealengine.com/u/RecourseDesign)\
**Post date:** [July 19, 2024, 6:58pm UTC](https://forums.unrealengine.com/t/optimizing-many-dynamic-light-sources-in-ue-5-4/1941916/9 "2024-07-19T18:58:46Z")

</div>

Something we’ve been playing with is reusing lights by moving the furthest lights to proximity - also, we’re using singleton interiors to buildings which get moved into the closest house - that allows for a lot of lights. Also swapping lights for emmissive based materials in the distance.

---

<div class="post-metadata">

**Author:** ![Trastrastras](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Trastrastras](https://forums.unrealengine.com/u/Trastrastras)\
**Post date:** [July 19, 2024, 9:10pm UTC](https://forums.unrealengine.com/t/optimizing-many-dynamic-light-sources-in-ue-5-4/1941916/10 "2024-07-19T21:10:25Z")

</div>

I mainly set the draw distance on the light - to what distance should it be drawn.

light radius - the smaller the better. In advanced settings, there is a light falloff exponent, in case you want the light to shine near the border of the radius.

If you can shine a light without a shadow - it is very cheap.

I don’t use pointlights, only in rare cases - they are much more expensive in terms of performance than spotlights. Spotlight with large radius can be preaty heavy. same for rect lights.

I don’t rely on Lumen, its indirect lightning and emissive materials - they are turned off on medium settings, but they increase your FPS performance a lot (in my case, even double). that’s why I have set the scene so that it looks very similar both on Epic and on medium (it is necessary to match DFAO for medium details (skylight settings) and skylight leaking (postprocess volume settings for Lumen).  
But for medium settings, i needed turn of DFAO specular occlusion on 5.3.2, because it doesnt work properly (interiors were grey and shiny as hell)

I don’t use distance field shadows anymore - they are still turned off on medium.

I pay attention to the light in the interiors, so that the light complexity does not increase - a pair of lights, half on one side of the wall, the other on the other can cross radius and can cause more fps drops.

Less is better - sometimes is better less lights for better atmosphere (like 70 percent on screen are shadows).

For classic shadows, there is max shadows distance and distance field shadows distance options

---

<div class="post-metadata">

**Author:** ![Gamefel](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gamefel](https://forums.unrealengine.com/u/Gamefel)\
**Post date:** [July 23, 2024, 9:08am UTC](https://forums.unrealengine.com/t/optimizing-many-dynamic-light-sources-in-ue-5-4/1941916/11 "2024-07-23T09:08:48Z")

</div>

Thanks for the many answers - that will give me a good idea what I have to keep in mind! Do you guys know, if you can fade between light sources, where one has shadow enabled and the other not (still working with VSM)? The aim would be to smoothly fade between shadow/non shadow in relation how far the player is away from a light.

---

<div class="post-metadata">

**Author:** ![glitchered](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/glitchered/32/768299_2.png) [@glitchered](https://forums.unrealengine.com/u/glitchered)\
**Post date:** [July 23, 2024, 9:46am UTC](https://forums.unrealengine.com/t/optimizing-many-dynamic-light-sources-in-ue-5-4/1941916/12 "2024-07-23T09:46:58Z")

</div>

no. shadows can only switch on or off. there’s no smooth transition. depending on the light situation it would look rather weird to go frrom shadowed to fully lit anyway. the other way would be more appropriate… to fade the light intensity to zero or ambient or fog value and switch it off. a more natural fade.

---

<div class="post-metadata">

**Author:** ![Gamefel](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gamefel](https://forums.unrealengine.com/u/Gamefel)\
**Post date:** [July 23, 2024, 2:43pm UTC](https://forums.unrealengine.com/t/optimizing-many-dynamic-light-sources-in-ue-5-4/1941916/13 "2024-07-23T14:43:45Z")

</div>

Alright, thank you!
