In this guide, we will explain how to add night lighting to your maps.
The map used for this tutorial can be found in: "ExampleContent Content/Maps/NightTutorial"
Assuming that you want to add night mode to your existing map, the first step is to add a sublevel to your Persistent level solely for night lighting. Before we do this, make sure all your lights, global elements like fog and sky sphere are all inside the GlobalDay sublevel, as shown below:
(Light importance volume can stay in the Persistent level, including reflection captures)
Next step, let’s make sure the GlobalDay sublevel is set as a lighting scenario:
Highlighted in green in the above image, you can see the sun is enabled, make sure this is the same on your end. This will tell the engine that this sublevel is being used as a Lighting Scenario, this is important to make our Night lighting functional.
Alright next step we will be adding our Night sublevel and this step will make it more clear why everything related to GlobalDay should be in its own sublevel.
We open first the content browser and open the folder where our level is located and in here we duplicate the NightTutorial_GlobalDay sublevel:
Then rename the duplicated file to “NightTutorial_GlobalNight” and you should have two files now. _GlobalDay and _GlobalNight:
Great! Next step we’re going to attach NightTutorial_GlobalNight to our Persistent level.
First open the Levels Panel and click on the little arrow pointing down next to Levels.In the menu click on “Add existing”:
In the Open Level window, we select our _GlobalNight sublevel and click on the button open:
Now you should have two sublevels attached to your level _GlobalDay and _GlobalNight. You can set your GlobalDay sublevel to invisible to check if your lights and global level elements are duplicated correctly, also check if your _GlobalNight sublevel is set as a Lighting Scenario, the sun icon should be enabled:
You might see a cross through your Directional Light Source, as shown below:
Make it dark
Currently we have two identical Light Scenarios with the same light settings, both are day time, but for our Night sublevel we want to make it obviously dark.
Make sure you only have the _GlobalNight sublevel enabled and set it as your current level. inside the _GlobalNight sublevel we delete the Sky Sphere and instead we will be using a static skybox. Inside the Content Browser search for skybox. Select the static mesh Skybox and drag it into the viewport. Make sure in the Details panel the location is “0 0 0” and set scale of the skybox to “100 100 100”
By default the material assigned to it is for daytime. We’re going to change that to night. Select your Skybox and open the Details panel. Now in the content browser we search for “M_Skybox_Night_03” and assign this material to our Skybox:
It’s currently still very bright, so let’s change the intensity of our Light Source (directional light). Set the intensity of your light source to something very small 0.01 lux. SkyLight can stay as is. Rebuild the lighting and you should have something like this:
Beautiful! Alright next step we’re going to tweak fog.
We’re not going too much into the complexity of fog settings but we want to add some basic fog in our level to add a more natural darkness and get rid of the hard lines on the horizon. So let’s first start by placing Exponential Height Fog, just drag it into your level. Open the details panel of your ExponentialHeightFog and change the fog density to 0.005 and Fog Height Falloff to 0.22 and finally set Fog Inscattering color to black. You might want to adjust these settings a bit to make it fit better for your environment. You should have the following result:
Much better! But still the background looks kinda bright, let’s improve that next.
For this we’re going to adjust the Atmospheric fog. Select the Atmospheric Fog, it should be already there because it was duplicated from the _GlobalDay sublevel. Open the details panel for the Atmospheric Fog and change Density Multiplier to 3 and you should have a similar result as the screen below:
Awesome! Now that we have our night lighting scenario all set up we’re going to the final step and make it functional inside the game.
Open the World Settings of your level and in the detail panel navigate to “Lighting Scenario”
In the green highlighted section above we’re going to add our sublevels and create Lighting Scenarios keys. Lighting Scenario key links with the sublevel. So in this case we’re going to create two keys.
First we click on the plus next to Lighting Scenarios and it will create a new element.
In the first box we add “Day” in the box next to it we add NightTutorial_GlobalDay. Then we add another Lighting Scenario with the plus and add the following, first box: Night and the box next to it NightTutorial_GlobalNight. Make sure to spell your sublevel names correctly, otherwise the sublevel won’t load in the game. See the final result below:
As you can see we also set the Default Lighting Scenario to Day, it’s not a requirement, but in our studio we work with multiple developers on the same level and just makes it more clear for everyone which lighting scenario is default.
To properly build lighting for multiple light scenarios you have to rebuild lighting for each lighting scenario. So if the map contains a day and night sublevel, the lighting needs to be build twice, once with the day lighting sublevel visible and second time with the night sublevel visible, make sure there is only one light sublevel visible when rebuilding lighting.
Reflection captures only have to be build once if they're inside the Persistent level or in a sublevel that's set to always loaded.
Test Night Lighting
To check if the light sublevels are working ingame you can load them through the Lighting Scenario override in the play menu, just select the one you like to try and hit the play button or Alt+P. As a reminder make sure the map has a valid gamemode scenario assigned to it.