Download

Managing many lights

Hi everyone,

I’m working on a archviz project with a day-night cycle. When the sun goes down, I want lights and emissive materials to turn on. There are many lights and static meshes with emissive material in the level.

I managed to do this in 2 ways, but I am a newbie and I can’t tell which one is better / more efficient:

1) Using BluePrints
I made very simple blueprint actors with just a spotlight (or a point light) and 2 events (LightON and LightOFF) that control the Intensity.
I made also blueprint actors with a static mesh with a emissive material and 2 events (LightON and LightOFF) that modify a Dynamic Material Instance based on the emissive material.
When the Time of Day is within a certain range, a BluePrint Actor calls all the custom events with “Get all actors of class” > “For Each Loop” and I have to do that for all the different BluePrint Actors I made.

2) Using Material Parameter Collection
I made a MPC with a scalar parameter set to 0.
Then I made a emissive material using the MPC and a Light Function material using the same MPC.
I use the emissive material for static meshes and Light Function material for the spotlights, point lights etc.
When the Time of Day is within a certain range, a BluePrint Actor changes the parameter in MPC from 0 to 1, and lights turn on.

In both cases I use a timeline with a Lerp and I get a nice transition when everything turns on.

I think that using MPC is easier because I don’t need to create BluePrints, I just place static meshes / lights in the scene and apply the material / light function. If I want to make different kind of lights, I just have to make a material instance.

But again, I’m a newbie with UE.

Thanks in advance!!

Hi, first off, many dynamic lights are one of the fastest and easiest way to kill your performance.

Using light functions will cost you extra performance, so blueprints may be the better choice. You could also think about using static lightning for all those lights and use lightningscenarios (never done this though so I can’t guarantee that it will work for you), so you will basically have one scene with all lights on and one with all lights off (directional light can still be dynamic for a smooth day night cycle). Static lightning will cost you nearly no performance (and it makes no difference for performance whether you have one static light or one thousand).

So take a look at this here Precomputed Lighting Scenarios | Unreal Engine Documentation and How can I switch between day and night scenes in the same space? - UE4 AnswerHub