One of the most technical aspects of lighting is making it look good without sacrificing performance. In today’s tutorial, we’ll be diving into that. Let’s dive right in: what tools do we have in our arsenal to achieve good lighting?
Before we dive into it, there are a few definitely-100%-must-know things that I want to mention. If you have no prior knowledge of how “lighting” works in real life and how UE5 handles shadows, I definitely suggest reading these as well.
This built-in little tool gives you access to almost everything (Directional Light, HDRI Backdrop, Sky Atmosphere, Volumetric Cloud, Exponential Height Fog) to start lighting your scene.
I'll be using everything here in default, except I have made some minor changes to my exposure settings in my post-processing.
Every single light source you place in your level has its own individual shadow resolution scale. This is the shadow "resolution" that determines how detailed the shadows will be when cast by this specific light source. Some other things worth mentioning:
So this parameter on UE5 lights (Directional, Spot, Point, Rect) basically controls how detailed the shadows cast by that light should be. By default, it comes at 1; increasing it to 2 already makes you see a significant difference. 3 and beyond could be useful in some specific cases, but most of the time the difference between 2 and 3 is negligible, considering we also need to keep the game as optimized as possible, and this is a heavy-on-hardware option. In most cases, 2 will give you a very nicely detailed shadow. You can tell how much the quality improves if you have a tree around with moving branches and leaves:
Shadow Resolution Scale: 0 vs 1 vs 2
Shadow Resolution Scale: 3 vs 5
In some cases, you will get almost no improvement, so remember: this is a heavy feature; use it wisely.
Shadow Resolution Scale: 0 vs 3
This option simply decides how far a light casts small, detailed shadows right at the surfaces where geometry meets other geometry. “Tight shadows” that appear in crevices, corners, and where objects touch the ground in othert words. Only affects shadows very close to surfaces.
Contact Shadow Length: 0 vs 500
Contact Shadow Length: 0 vs 1
Contact Shadow Length: 1 vs 0.2
Any cinematic or high-quality atmosphere needs light scattering. Sky Atmosphere does exactly that: it simulates light scattering in the atmosphere. The simulation works by modeling Rayleigh and Mie scattering. Rayleigh scattering primarily determines how blue the sky appears, while Mie scattering contributes to hazy skies and bright halos around the sun.
Bright halos around the sun
Hazy skies
In addition to these, Sky Atmosphere can react to time-of-day changes; if your game requires such a system. When paired with a 'Directional Light' marked as 'Atmosphere Sun Light,'' it renders the sun disk based on atmospheric scattering and affects overall atmospheric brightness and color as well. But most importantly, it also provides a physically accurate distance fog (Aerial Perspective / Atmospheric Fog) that blends realistically with sky colors and changes with altitude; for example, when standing on a mountain.
One feature that we are interested in Sky Atmosphere for us is the Height Fog Contribution. Height Fog Contribution in UE5’s SkyAtmosphere controls how much the SkyAtmosphere influences the appearance of Exponential Height Fog (ExponentialHeightFog actor) that we are going to place in our level. This option, in other words, decides how much blending happens between the SkyAtmosphere and the ExponentialHeightFog actor. Higher values (1.0 → 2.0+) mean that the height fog inherits more sky/atmospheric color. Lower values (0.0 → 0.5) are used to achieve a specific and/or cinematic look.
Height Fog Contribution: 5 vs 0
Height Fog Contribution: 6 vs 0
Height Fog Contribution: 0.5 vs 2.0
Height Fog Contribution: 0
Question: Do you need a skylight if your level already has an HDRI and a directional light?
Answer: No, you don’t need a Skylight if you already have an HDRI Backdrop and a Directional Light.
In simple terms, what this option does is make the shadows sharper. It is also used in cases to prevent shadow acne, which is a flickering or dark speckled artifact caused by a surface shadowing itself.
Shadow Bias: 1.0 vs 0
Shadow Bias: 0 vs 1.0 vs 0.04
Shadow Bias: 1
Shadow Bias: 0
Shadow Bias: 0 vs 0.1 vs 0.3 vs 0.7 (See how the shadows look ‘patchy’ on the bollards when the value is too low.)
Now let's talk about Shadow Slope Bias. By editing our Shadow Slope Bias value, we made our shadows sharper. But we wanna soften the edges and stuff a bit. And that's when we use Shadow Slope Bias. It can also be used to reduce shadow artifacts on surfaces angled toward the light!
Shadow Slope Bias: 0 vs 1
Shadow Slope Bias: 0.5
Here, I will start adding an HDRI backdrop to my scene and begin adjusting the lighting. I’ll go through each important step here. This is not a follow-along tutorial, so take what you learn here and apply it to your own scene. First, bring your texture into the engine and assign it to the HDRI backdrop. When we drop something into the level, Unreal places it in the world and adjusts the location of the object based on where you dropped it. So the first thing to do is reset its location to its default values, which should be 0, 0, 0:
Reset the location to (0, 0, 0).
When it comes to intensity, the HDRi plugin offers us two options. These determine how bright we want our HDRi texture (i.e., the sky texture itself) to be without affecting the landscape, as well as the intensity value that controls the ambient cubemap over the landscape.
Adjusting the intensity here in this component (HDRIBackdrop) will increase the brightness of the sky texture/dome, but not the lighting intensity (ambient cubemap) of the world.
To enable the ambient cubemap of the HDRI plugin, you gotta switch to the geometry section, set your source type from "SLS Captured Scene" to "Cubemap," and select the same HDRI texture you’re using for your sky texture/dome.
Now we can decide here how much it (the ambient cubemap) should brighten our world, without affecting the brightness of the sky texture/dome.
Let me underline this part again: notice how the HDRI doesn’t cast any shadows but only provides some ambient light.:
HDRi Ambient Cubemap Intensity: 10000
HDRi Ambient Cubemap Intensity: 0
And this is exactly why we need other types of light sources, such as directional lights, rectangle lights, etc., to create shadows.
Lower Hemisphere is Solid Color: False (Default)
Lower Hemisphere is Solid Color: True
Defines the resolution of the HDRi cubemap used for lighting/how bright the HDRi makes the landscape. Higher values mean sharper lighting detail and more accurate reflections, but heavier on performance. Common values are usually 256 or 512 for games, can be increased to 1024+ for cinematic quality.
Cubemap Resolution: 8
Cubemap Resolution: 2048 vs 512
Cubemap Resolution: 256 vs 512
It controls the rotation value of the cubemap texture used in "HDRIBackdrop > Skylight". The value here rotates the ambient light without rotating the actual sky texture/HDRIBackdrop dome. Extremely useful if you want to rotate the light direction (ambient light) but keep the backdrop image (sky texture/dome) fixed.
Source Cubemap Angle: 0
Source Cubemap Angle: 115
Another issue you might have and not realize what’s causing it is the HDRi colliding with an asset in your level, for example:
As you can see here, my HDRi backdrop collides with my 'cave' assets and creates this white silhouette around them.
To get rid of this 'artifact,' we can move it up in the location (Z) so it doesn't collide with our mesh anymore:
Setting the location of my HDRi in the Z direction.
If you have ever worked with HDRIs in UE5, you might already know that they can be rotated only around the Z axis:
Rotating the HDRi along the Z-axis: 01
Rotating the HDRi along the Z-axis: 02
Now the question is, what if we need to rotate our texture in the Y direction? Then the projection center comes in help. The projection center can be considered as the Y rotation in such occasions:
I want the 'moon kinda looking' part of my texture/dome to appear at the top part of my cave, so I start rotating it in the Z direction around the projection center.
Sometimes you might need to enter very high values here to make the HDRi rotate.
Earlier, I was only able to rotate my HDRi plugin around the Z axis in the HDRi (rotation) itself; now I am changing the projection center (Z axis) so it can move up exactly here:
Now pay attention, how the moon will be located right at the top of where my cave ends.
We can go back to the HDRi's own rotation value to place the moon in the center.
I am increasing the brightness of my sky texture/dome (so no ambient cubemap adjustment) so we can see the sky a bit better. (Part: 01)
I am increasing the brightness of my sky texture/dome (so no ambient cubemap adjustment) so we can see the sky a bit better. (Part: 02)
Did you know that "Directional Light" has its own built-in light shaft system, so you don’t need to rely on volumetric fog for beautiful shafts? Volumetric fog is stunning, but it’s very heavy on performance; 10 to 20 FPS or even more, depending on your level. Here’s how to activate it, and remember: this feature is only available for the Directional Light type:
Light Shaft Occlusion: Set it to true to get beautiful light shafts! Then activate Light Shaft Bloom to make 'em even brighter!
Don't forget to set "Light Shaft Bloom" to true!
Bloom Scale: 5 vs 2
Next, we can work on positioning our lift shafts/godrays. To do this, we can manipulate the data found in the "Light Shaft Override" section. What this option does is decouple the visual "God Rays" (Light Shafts) from the actual rotation of your Directional Light, allowing us to override the default value and change the position of our light shafts:
Light Shaft Override Direction: 0 (Default)
Light Shaft Override Direction: (Modified)
The value here represents a distance in Unreal Units (cm) and means, anything closer to the camera than this distance will not occlude (block) the light shafts. Anything further than this distance will cast a shadow into the light shafts. Some of the usage cases that I can think of off the top of my head are usually like this:
Occlusion Depth Range: 0
Occlusion Depth Range: 1600+
Directly affects the softness of shadows and the sun halo appearance. This can be considered the "Source Radius" for other light types. When it comes to directional light, you can think of it as just a name change, because for a Directional Light, the radius is measured in degrees since the sun is effectively at “infinity.”
Some other example values:
Source Angle: 5
Source Angle: 50
By default, this value is 0, meaning the atmosphere starts scattering light immediately from the camera's position. By increasing this value, we can create a "clear zone" around the camera, where no atmospheric scattering (haze/fogging of the sky) occurs. It can be used to prevent foggy interiors: For example; if our character is inside a building or a cave, the Sky Atmosphere can sometimes make the air inside look hazy or blueish because it’s calculating scattering everywhere. By setting a Start Distance, we can push that "haze" outside the building. It can also help maintain foreground clarity; in wide landscape shots, we might want a thick, moody atmosphere in the distance but want our immediate foreground (like a character or nearby rocks) to remain crisp and high-contrast.
Directional Scattering Start Distance: 10000 (Notice how the fog becomes less thick when we increase this value.)
Decides how sharply the light scatters through the atmosphere, especially through fog, skyAtmosphere, and volumetrics.
Directional Inscattering Exponent: 100 vs 50 vs 5
Directional Inscattering Exponent: 4 vs 8
One other option you might see in the Exponential Height Fog component is “Cloud AO (Atmosphere and Cloud)”. What this option does is toggle whether the volumetric clouds (if you have one in your scene) shadow the fog itself. If you don’t have a volumetric cloud in your scene, enabling it will not do anything. This is an option that I rarely use, so I won’t touch it, since I have no clouds in my level anyway, but feel free to experiment with it. Just remember, dynamic shadows are expensive.
We already talked how rayleigh scattering primarily determines how blue the sky appears in the "Must Know 04: What the hell does the sky atmosphere do, and why do we need it?" chapter, but it also controls the reddish/orange tint at sunrise and sunset. Higher values mean more scattering. Lower values mean less scattering. 0 means no Rayleigh scattering, in other words, rayleight scattering doesn't contribute to the sky color when it's off.
Rayleigh Scattering Scale: 5
Rayleigh Scattering Scale: 25
Rayleigh Scattering Scale: 0
Mie Scattering is where things get a bit interesting. Mie Scattering tells SkyAtmosphere how light interacts with “larger particles such as dust, water droplets, smoke, etc.” and by doing so, it gives the atmosphere a soft, hazy look, especially near the horizon. In other words it helps light “travel” through the shafts, making them more visible.
Mie Scattering Scale: 0.003 vs 1
Different Mie colors also affect the appearance of light shafts.
This option basically decides how much light is pushed toward the viewer versus scattered evenly.
Mie Anisotropy: 0.5 vs 0.8
Mie Anisotropy: 0 vs 0.999
The effect, that makes far-away objects look bluish, hazy, or washed out due to the atmosphere between the camera and the object. In other words, how far the camera “sees” before haze becomes strong. Can be extremely useful for creating fog-heavy scenes.
Aerial Distance Plane Scale: 0 vs 5
Aerial Distance Plane Scale: 5 vs 0.2
Source Radius: 0 vs 5000 vs 100
Source Radius: 0 vs 1000
Soft Source Radius: 0 vs 1024
Soft Source Radius: 0 vs 1024
It took quite a while to write this tutorial, prepare all the screenshots, and find examples, but I think it was worth it. If you enjoy this type of detailed, written tutorials, please consider supporting this website through my Patreon. You can also send your questions to me directly there if you find anything confusing or would like more explanations regarding this topic or other topics. Until then, keep modeling and creating!