Lightmass, Unreal Engine 4’s precomputed lighting tool, is a complex beast with myriad options for configuration. With a better understanding of what those options are you can save days of computation time and still get the amazing lighting results your levels deserve.
This article is a comprehensive breakdown of the parameters found in the ‘Lightmass’ section of your map’s World Settings. We will look at each parameter in depth, with practical examples, and explore when and where each may be best applied.
Just a quick disclaimer before we begin: Although there are many lighting/Lightmass-related tips and tricks that can be broadly applied to most projects, I don’t know the specific requirements of yours. With this in mind, this guide will attempt to keep recommendations as general as possible. It’s my hope that, instead, I can provide the information you need to make the decisions for yourself.
Alright. Let’s go!
What is Lightmass?
Lightmass is an integrated part of Unreal Engine 4 which is responsible for precomputed lighting. This involves the generation of lightmaps, textures that are overlaid onto level geometry to give them the illusion of shadows, bounce lighting, and other natural lighting phenomena.
Features that Lightmass supports include global illumination (indirect/bounce lighting), ambient occlusion, volumetric lighting, and transmission (changes in color/intensity when light moves through semi-translucent objects).
These features are all ‘precomputed’ because they are generated before the game is run via a process called ‘baking’. Depending on the quality and scale of the bake, this process can take a long time.
All of these features are also collectively referred to as ‘static lighting’, as they cannot be changed while the game is running. This is why you can’t move static lights during play. They are quite literally baked into the scene, and you’d need to rebake them to see any of your changes reflected in the world’s lightmaps. This is separate and distinct from ‘dynamic lighting’, which can be altered at runtime. Lightmass does not handle dynamic lighting so that is a discussion for another time.
The Tower Scene
To explore what each lightmass setting does within a scene, we first need the scene. The one I’ve made for this tutorial is a small tower interior environment. It includes some interesting shapes perfectly suited for experimenting with indirect lighting, and a few more intricate assets from the engine’s starter content that we can use to push the details of our shadows.
Lightmass world settings in detail
We’ll be experimenting with each lightmass setting in turn to have a look at how it affects the scene. Before we jump in, for consistency’s sake each bake presented in this article, unless otherwise stated, will be viewed in the Detail Lighting view mode, and is baked at Production quality.
Let’s have a look at these settings.
Static Lighting Level Scale
The very first setting in the list, and one of the most important. Static Lighting Level Scale tells Lightmass the size of the samples it will take of your scene to evaluate shadow detail. The smaller the value, the higher the level of detail.
You can use this setting to increase the intricacy of your shadows, although this higher level of detail usually comes at the cost of more visual noise. This can be compensated by increasing the Indirect Lighting Smoothness value, which we’ll get to in a bit.
Static Lighting Level Scale will have a big effect on the overall accuracy of your precomputed lighting. With no additional cost to the size of your lightmaps, at runtime it’s effectively free – but it will definitely blow out your bake times.
|Static Lighting Level Scale||Bake duration||Factor|
|1.0 (default)||3:02 min||1|
For final bakes, a lighting Static Lighting Level Scale of .1 is often recommended, especially for architectural visualization projects. In the tooltip for this setting, Epic also suggests turning this value up to 2 or 4 for larger environments like landscapes, where high detail isn’t required.
Num Indirect Lighting Bounces
Indirect lighting is a phenomenon that occurs when light waves bounce off objects in the world to hit surfaces that are not in direct line of sight with the light source. The more times the light bounces the more light will enter the space, and every bounce will make the light decay until the effect is no longer noticeable. The end result is what we call ‘ambient lighting’.
The same is true for virtual lighting with Lightmass. This setting will tell the engine how many times each virtual photon will bounce. If this setting is set to zero, there will be no indirect lighting in the scene.
Bounces will have diminishing returns as the light decays, and successive bounces after the second will not significantly affect the visual fidelity of your lighting or the time it needs to bake. A value of 4 is virtually identical to a value of 100. Don’t that stop you cranking this value all the way up if you want, though!
Num Sky Lighting Bounces
This value has much the same effect as the above Num Indirect Lighting Bounces value, but it is specific to static lighting from Sky Lights.
However, unlike Num Indirect Lighting Bounces, the amount of time this setting adds to your bake is proportional to its value. Each successive bounce will add approximately the same amount of time.
The effect of Num Sky Lighting Bounces is subtle, and is easily drowned out by ambient light from a scene’s dominant directional light.
For this setting to do anything at all, both Num Sky Lighting Bounces and Num Indirect Lighting Bounces need to be greater than 0.
Indirect Lighting Quality
Of all the parameters available to Lightmass, the Indirect Lighting Quality setting will have the most significant impact on both the quality of your light bake and the time it takes to complete.
Increasing this value higher than its default of 1 (it can go up to 10) will increase the number of Global Illumination samples Lightmass will take to evaluate your lightmaps, making for higher fidelity static lighting.
Indirect Lighting Quality is commonly used in tandem with Static Lighting Level Scale as the primary method of increasing the quality of your light bakes and like Static Lighting Level Scale, it will drastically increase your bake time.
|Indirect Lighting Quality||Bake duration||Factor|
|1.0 (default)||3:09 min||1|
Static Lighting Level Scale * Indirect Lighting Quality = 1
|Static Lighting Level Scale||Indirect Lighting Quality|
Indirect Lighting Smoothness
This setting will reduce the level of detail in your indirect shadows by smoothing them out. The higher the value, the more smoothing there will be. At higher values, you will start to see loss of shadow detail and light bleeding.
Indirect Lighting Smoothness can be used to control the level of noise in your lightmaps, but this will come at the cost of reduced shadow definition.
The Environment Color parameter is a linear color with which you can globally tint your static lighting. This is one method of tweaking color temperature or mood without editing individual lights, and while its impact on bake times is minimal, it does have significant drawbacks.
The way it works is simple. Lightmass takes the lighting information it has generated at the end of a bake and projects this value (multiplied by your Environment Intensity) from the upper hemisphere down onto the result. As it’s additive, this means that there will be some color blending if you already have tinted lights in your level. In the example above, the red environment color is mixing with the blue of the Sky Light, and so the result comes out purple.
Interestingly, the Environment Color value has an alpha channel but it doesn’t seem to do anything.
By default, Environment Color is set to 0,0,0 which is effectively the same as this feature being disabled. This is because Epic is discouraging its use, and for good reason. As this kind of environment lighting is calculated at the very end of the process, Environment Color is not taken into account when bounce lighting is determined, which makes it not physically accurate. Moreover, it will affect the intensity of your reflection capture actors in a way that means they do not accurately reflect the scene anymore.
If you want to globally add ambient light to your scene it’s highly recommended (by both Epic and myself) you leave this setting alone and instead use a Sky Light.
Side note: I noticed a number of people on Unreal Answers trying to alter this setting at runtime to create dynamic lighting changes. This just isn’t possible. I suggest looking into stationary Sky Lights.
If you’re using Environment Color, then you’ll be able to use the Environment Intensity parameter to scale its effect on your level. The strength of the added light will be multiplied by this setting, so a value of 0 will disable this method of environmental lighting, while a value of 2 will double its effect.
Like Environment Color above, this setting has a negligible impact on bake times. By default it is set to 1, although this doesn’t do anything unless you also change Environment Color from it’s default black. Likewise, if this setting is set to 0, the Environment Color parameter will be greyed out.
An object’s diffuse value (also called ‘Albedo’ or ‘Base Color’) is its color before any other information (like static lighting or material effects) is layered on. You can view the diffuse value of objects in your level by switching to the ‘Unlit’ view mode in your viewport.
Diffuse color is defined by an object’s material, and its value will affect the color and intensity of the light that bounces from its surface. For example, a surface with a low diffuse value of 0.1 will absorb a lot more light than one with the higher value of 0.9, making for a darker environment overall.
The Diffuse Boost parameter will globally scale how much your materials diffuse value will contribute to static lighting. By default it is set to 1.
It should be mentioned that each material (and material instance) has its own diffuse boost value. This will not override the setting within Lightmass, but rather be multiplied by it. This means that if your material’s diffuse boost is 2, for example, and your Lightmass Diffuse Boost setting is also 2, then that object will contribute 4 times as much when indirect lighting is calculated.
Volume Lighting Method
The set of data used to apply indirect lighting to dynamic objects is called ‘Volume Lighting’. Lightmass will sample static lighting across a configurable range of positions in the world, and use that data to create a volume which can be referenced at runtime. When an object moves through the level, Unreal will blend between these samples to create an approximation of the indirect lighting in the scene.
Unreal offers two different volume lighting methods, and each has their own unique set up options which are covered a little further down.
The default setting, and a newer method (as of version 4.25) that Epic recommends. The Volumetric Lightmap method uses a Third Order Spherical Harmonic sample to capture light from all directions.
You can see the result of your volumetric lightmap bake from the Show menu in your viewport, and clicking Visualize > Volumetric Lightmap.
Sparse Volume Lighting Samples (also known as the Indirect Lighting Cache)
An older method of generating volume lighting, Sparse Volume Lighting Samples will capture a single color value for each sample it takes of your level.
You can see these values by selecting the Volume Lightmap Samples option within the same Visualize submenu. You will only be able to see either of these if you have baked your lighting with the appropriate method selected.
Both volume lighting methods rely on a user-placed Lightmass Importance Volume to guide the engine as to the space in which you want samples to be taken.
For a deeper dive into this part of Lightmass, I highly encourage you to explore both of the above links. Epic has done an amazing job at breaking it down for us.
Use Ambient Occlusion
Ambient occlusion is a lighting technique used to define indirect shadowing on objects, and Unreal provides a few different implementations. If this setting is checked, Lightmass will bake ambient occlusion information into your surface lightmaps. It will have a minimal effect on bake times.
Use Ambient Occlusion is unchecked and disabled by default.
Generate Ambient Occlusion Material Mask
When enabled, this feature provides access to the ambient occlusion data generated by Lightmass within the material editor via the ‘PrecomputedAOMask’ material node. This is particularly useful for blending difference surfaces together, but can be used for a range of different purposes.
This setting won’t affect the duration of a bake as Lightmass generates this data when Use Ambient Occlusion is enabled regardless.
Visualize Material Diffuse
This is a debug setting that lets you visualize your level’s diffuse contribution to static lighting. If you’re getting strange lighting results, Visualize Material Diffuse can be a quick way to see which actors in your scene are influencing lightmass.
Visualize Material Diffuse will override both the lights in your level and the Visualize Ambient Occlusion setting detailed below.
Visualize Ambient Occlusion
Visualize Ambient Occlusion is another debug setting. Enabling it will override the lights in your scene and present just the ambient occlusion component. Like Visualize Material Diffuse, this setting is useful for resolving issues and fine tuning other values.
You will need to set Use Ambient Occlusion to true for this setting to have any effect.
For most projects that use static lighting, it’s very likely that a considerable amount of your texture streaming pool will be occupied by lightmap textures. To help alleviate that load, by default Unreal will compress them to save runtime memory and disk space.
Unfortunately, out of the box we don’t have much control over when and how this compression takes place, but we can wholesale turn it off by setting Compress Lightmaps to false.
It’s important to note that although the effect that disabling compression will have on the fidelity of your lighting can be subtle, its impact on the size of your lightmaps will be significant.
Your maps will have less artifacts and noise (most notable on larger, flat surfaces like walls and floors), but at the same time your texture sizes will increase roughly fourfold. It’s up to you to decide if such a cost is worth the result.
Side note: I have seen good results when switching over to Crunch compression in the rendering tab of your Project Settings. It looks like a promising alternative to default lightmap compression, but I’ve not explored it enough to have a strong opinion just yet.
This article is a work in progress. It is my hope that the rest of Unreal Engine’s Lightmass settings will be added in the near future, with additional examples.
Thank you for reading, I hope you found it useful.