Unreal Engine’s lighting tools are both powerful and versatile, designed to suit a diverse range of indoor and outdoor environments. To achieve this flexibility the engine provides multiple lighting solutions and a lot of customizable parameters. One of the most important of these is light mobility.
Found under the Transform category, all Unreal Engine light actors have a mobility property which defines how the light is generated. The choice between Static, Stationary, or Movable mobility has a significant impact on the light’s runtime capabilities and performance cost.
This article will break down the strengths and weaknesses of each mobility type and provide a practical guide to choosing which is right for your specific art and gameplay requirements. As is usually the case in game development there is always a tradeoff between performance and graphical fidelity. You may need to determine which lighting features are the most important to you and be prepared to compromise on the rest.
Why do I need to select a mobility type for my lights?
You might be asking yourself why you have to make this decision at all. Why can’t you just use the best lighting solution all the time?
Well, about that…
In computer graphics there are many different techniques that can be used to simulate realistic lighting in a virtual environment, and they are being continually studied and refined as new technologies become available. Unreal itself uses several different methods, and each has its own strengths and weaknesses. Unfortunately there is no one-size-fits-all solution to this problem.
In practical terms, this makes the three mobility types available in Unreal Engine Epic’s best attempt at providing developers with three options designed to suit the widest range of use cases.
Here is a quick overview of the three mobility solutions that Unreal provides, the runtime features available in each, and the way they are implemented. If this doesn’t make much sense to you, don’t worry. We’ll be going over this in more detail in the sections to come.
|Precomputed indirect lighting (Lightmass)||Yes||Yes||No|
|Static geometry||Lightmapping||Lightmapping||Whole scene dynamic shadows (direct lighting only)|
|Movable geometry||Volume lighting||Distance field shadows||Whole scene dynamic shadows (direct lighting only)|
generate lighting information depending on the mesh actor’s mobility settings.
The simplest of the three mobility options, Static lighting is the most performant and the least flexible. As the name suggests, lights with Static mobility are entirely precomputed in the editor and cannot be altered while the game is running.
- Very performant.
- Entirely precomputed, providing high quality indirect lighting for ‘free’.
- Lightmaps have an associated memory cost which can quickly consume your texture budget.
Using Lightmass, Unreal Engine’s precomputed lighting toolset, Static lighting information is generated and assigned to world geometry in a process called baking. For static geometry, Lightmass will generate lightmaps; textures that contain both shadow and indirect lighting information that are overlaid onto each applicable mesh.
Static lights also contribute to the volume lighting samples that Lightmass captures for dynamic/movable actors.
Lighting quality is highly dependent on the resolution of the generated lightmaps, the placement of your Lightmass Importance Volume, and the values found in the Lightmass section of your level’s World Settings.
If you’re interested in learning more about Lightmass and Unreal Engine’s approach to Static lighting, check out my visual breakdown of the Lightmass World Settings, which explores each value in excruciating detail.
As Static lighting information is precomputed, once baked these lights have no further impact on performance. This means the number of static lights you can place in your scene is virtually unlimited.
While static lights are effectively free at runtime, it should be noted that lightmaps definitely have an impact. Like any other texture they need to be loaded into memory, and having a lot of high resolution lightmaps can burn through your texture streaming pool faster than you might think.
Other notable features of Static lights
Precomputed indirect lighting
Static lighting takes full advantage of the indirect (or bounce) lighting capabilities that Lightmass affords. This includes sky light bounces, indirect lighting contribution from world albedo, and baked ambient occlusion.
Softened shadows for Point Lights
A feature of Static point lights is that their Source Radius parameter will also affect the softness of their shadows. The smaller the number, the sharper the shadow.
Stationary lights represent a compromise between the inflexibility of static lighting and the fully dynamic solution offered by Movable lights. They use a combination of techniques to provide both high fidelity dynamic shadows and Lightmass-generated indirect lighting.
- Highest fidelity, combining the flexibility of dynamic shadow casting with the indirect lighting capabilities of Lightmass.
- Supports runtime changes to light intensity and color.
- Far more expensive than Static lighting.
- You are limited to a maximum of 4 overlapping shadowed lights per mesh.
Unlike lights with Static mobility, certain parameters of Stationary lights can be altered at runtime, including their color and intensity. They also support light functions, materials that can be used to mask/animate the projected light.
As Stationary lights use dynamic lighting for movable actors but rely on Lightmass for everything else, runtime changes will not affect indirect lighting. This can lead to inaccurate lighting results.
Direct lighting information for Stationary lights is stored in a texture called a shadowmap. With a maximum of four channels, this means each mesh can be influenced by up to four overlapping lights before the system has nowhere to store the information. Should this happen the light will default to whole scene dynamic shadows, effectively becoming a Movable light (which we’ll discuss in a moment).
The engine will tell you if it cannot assign a shadowmap channel by placing a red X over the offending light. You can use the Optimization view mode StationaryLightOverlap to highlight where overlaps are occurring. Meshes in the scene will turn from green to red as they are lit by overlapping Stationary lights. Any red tinting is an indication that you have more than four overlapping lights and one or more of them has defaulted to an entirely dynamic solution.
Other notable features of Stationary lights
The Stationary light solution for softer shadows, the checkbox parameter Use Area Shadows for Stationary Light will cause the edges of shadows to soften the further they get from the caster.
It’s important to keep in mind that if this setting is enabled, a much higher lightmap resolution will be needed to maintain the same shadow fidelity.
Shadowing for dynamic objects with translucency is very cheap for Stationary lighting as it uses a precomputed depth map which is applied at runtime.
This method of shadowing is very fast, but is only accurate to the meter. For more information on how to adjust the resolution of the shadow depth map check out the On Translucency section on this page of the documentation.
Movable is by far the most flexible lighting mobility option, but it is also the most expensive. Being generated entirely at runtime, almost all of the values of a Movable light can be altered dynamically. Unlike Stationary lights, this also includes its position and rotation.
- Fully dynamic.
- Does not contribute to precomputed indirect lighting.
Movable lights use whole scene dynamic shadows, a lighting solution that gets significantly more expensive as the number of meshes within the lights influence increases. Movable lights with a large influence radius are very costly.
Being entirely dynamic, Movable lights are completely ignored by Lightmass for the purposes of generating indirect lighting. If you’re using movable lights you may be interested using Screen Space Global Illumination instead. More information on SSGI can be found in the official documentation.
Other notable features of Movable lights
Shadow map caching
A feature of point and spot lights, shadow map caching will store the shadow information of a Movable light that isn’t moving so it doesn’t need to regenerate it every single frame.
As you might imagine, this is a powerful performance saving feature. For more information on how to calibrate the shadow map cache, check out the Shadow Map Caching section on this page.
The techarthub guide to selecting light mobility
I hope this article has helped provide a stronger understanding of each mobility type and how each may be best used utilized. If you’re still not sure about which one fits your particular use case – this blueprint graph may help. It’s time to ask yourself some questions.
I hope this guide helps you narrow down your choices. At the end of the day the best mobility settings for the lights in your level is going to be highly specific to your project’s requirements. Good luck!