Lighting for Mobile Platforms

Setting up lighting for mobile games.

Choose your operating system:

Windows

macOS

Linux

When using lights on mobile platforms in Unreal Engine 4 (UE4), there are certain restrictions that must be followed to ensure your project will run at the right frame rate on various mobile devices. In the following document, we will go over how you should setup your lighting for UE4 mobile projects.

Supported Features

The features listed below are supported on mobile platforms:

  • Linear HDR lighting.

  • Directional Lightmaps (Normal is taken into account).

  • Distance field shadows + analytical specular on the sun.

  • Image based specular lighting - nearest Reflection Capture is applied to each object, without parallax correction.

  • Dynamic objects receive lighting correctly but do not cast shadows.

Supported Light Types For Mobile

The following tables break down the type and number of lights that will work on mobile devices.

Static Lights

Light Type

Mobility

Number Supported

Project Settings flag

Additional Information

Directional

Static

No Limit

Allow Static Lighting

Best performance. Light and shadow baked into directional lightmaps. Reduced quality.

Point

Static

No Limit

Allow Static Lighting

Best performance. Light and shadow baked into directional lightmaps. Reduced quality.

Spot

Static

No Limit

Allow Static Lighting

Best performance. Light and shadow baked into directional lightmaps. Reduced quality.

Stationary Lights

Light Type

Mobility

Number Supported

Project Settings flag

Additional Information

Directional

Stationary

1

Allow Static Lighting

Best quality. Precalculated , Signed Distance Field Shadow Maps .

Point

Stationary

Unsupported

Allow Static Lighting

Stationary Mobility not supported, will be treated like Mobility = Static.

Spot

Stationary

Unsupported

Allow Static Lighting

Stationary Mobility not supported, will be treated like Mobility = Static.

Movable Lights

Light Type

Mobility

Number Supported

Project Settings flag

Additional Information

Directional

Movable

1

Support Movable Directional Lights

No shadows supported.

Point

Movable

Up to 4

Use Shared Movable Spotlight / Point Light Shaders

No shadows supported.

Spot *

Movable

Up to 4

Support Movable Spotlights

No shadows supported.

By default, support for Movable Spotlights on mobile devices is disabled. To enable this feature go to Project Settings > Rendering > Mobile Shader Premutations Reduction and then check the box next to the Support Movable Spotlights option to enable them. Once enabled you will then need to re-start the UE4 Editor before you are able to use them.

SupportMovableSpotLight.png

Reflections

While reflections can help to breathe life and believability into your mobile projects, there are a few restrictions you need to be aware of when using them on mobile devices. The information below should help make your reflections look the best they can on your target mobile device:

  • Disable any Ambient Cubemaps you have in your post process volumes by setting the Intensity to 0 .
    PP_Settings.png

  • Place SphereReflectionCaptures Actors in the areas that you want to capture lighting for reflections.

    Sphere Reflection Captures Off Sphere Reflection Captures Off

    Sphere Reflection Captures On Sphere Reflection Captures On

  • When making Materials that support reflections keep the following information in mind.

    • Make sure your Normal Maps has both high and low frequency detail in. This will help to break up the reflection making it more visually interesting.

      Flat Normal Map Flat Normal Map

      Rough Normal Map Rough Normal Map

    • Make sure your Roughness maps have varying intensities of whites and blacks as this will help to give you a varying degree of shiny and dull reflections.

      Varying Roughness Varying Roughness

      Flat Roughness Flat Roughness

    • Depending on the surface type the Metallic input should be a 1 or 0.

      Metallic Off Metallic Off

      Metallic On Metallic On

Note that each Static Mesh component gets assigned to the closest Reflection Capture . That means there will be seams in reflections between objects, and sometimes a large mesh will use an undesirable reflection capture that happened to be close to the mesh's center.

Skylight Reflections on Mobile

The Mobile Render can also use a Skylight Cubemap for Specular Reflections when no Reflection Capture Actors are relevant. To enable this all you need to do is remove any Reflection Capture Actors and make sure that Screen Space Reflections have been disabled. You can see an example of this in the following image comparison.

Skylight Reflections PC

Skylight Reflections Mobile

This feature is not supported on Android ES2 devices. Android ES2 devices will continue to render with no Scene Captures.

Specular Lighting for Mobile

Mobile Specular response has been changed to use the GGX Lighting model by default. This improves Specular quality on mobile devices to help it better match Shader Model 5 (SM5). Enabling this feature adds a small cost to the shader processing time. The previous Spherical Gaussian Specular model is still accessible, should this new change affect the look and feel of your project's lighting. To re-enable the previous Spherical Gaussian Specular model, you will need to do the following:

  1. Go to Project Settings > Rendering > Mobile.

  2. Check the box next to Use legacy shading model. UseOLDLegacyShadingModel.png

The image comparison slider below shows the difference between the current Specular shading model and the Use Legacy Shading Model option.

Legacy Shading Model

New Shading Model

Modulated Shadowing

Fully dynamic shadows help to add life and realism to your mobile projects. However, on some mobile devices, fully dynamic shadowing is not an option due to hardware restrictions and the high resource demands required to render dynamic shadows. To get around this a new, cheaper type of dynamic shadowing was introduced to UE4 called Modulated Shadows . For more information on how to setup Modulated Shadows check out using Modulated Shadows .

Dynamic Cascaded Shadow Maps

Stationary Directional lights are used to cast Whole-scene Dynamic Cascade Shadow Maps (CSM) shadows for just the dynamic objects in your scene. One of the benefits to using CSM shadows is that they will blend correctly with precomputed shadows cast by the static objects in the scene. CSM shadows also do not exhibit the double shadowing you see with Modulated shadows and are faster when casting dynamic shadows for multiple objects. For more information on how to setup Cascaded Shadows, check out using Cascaded Shadows .

Modulated Shadowing VS Dynamic Shadowing

While Modulated and Dynamic shadowing look and act very similar to one another, they are quite different. This is because Modulated shadows have a number of restrictions and hard limits that Dynamic shadows do not have, that allows them to perform better on mobile devices with limited hardware capabilities. In the image below you can see a comparison between Dynamic shadows and Modulated shadows.

Dynamic Shadows

Modulated Shadows

The following list highlights some of the features and restrictions Modulated shadows can provide if used in your UE4 Project.

  • Changing Shadow Color: You can change the color of the shadow that Modulated shadows cast by adjusting the Modulated Shadow Color option in the Light section of the Directional Light. This is useful if you want to adjust the color of your shadows for game play or artistic reasons.

    Click for full image.

  • Shadow Blending: Unlike Dynamic shadows, Modulated shadows can not blend with other shadows, either baked or dynamic, that you see in your project's. This means that when a Modulated shadow is on top of another shadow, both shadows will show instead of a single shadow that blends together.

    Dynamic Shadows Dynamic Shadows

    Modulated Shadows Modulated Shadows

Working with Modulated and Dynamic Shadows

When working with Modulated and Dynamic shadows, there are a few console and .INI settings that can be used to adjust the look and performance of the shadows. In the following section, we will take a look at these settings and how they can be applied to your UE4 project.

As much as possible, Modulated shadows share code with the existing shadow tech. This means many of the shadow cvars and .INI settings that can be used with other shadowing methods will also work with both Modulated and Dynamic shadows.

  • Shadow Quality: When you first view dynamic shadows on a mobile device, the sharpness and quality of the Modulated shadows could be a bit lower than expected. To address this, you can adjust the shadow quality by opening up the Unreal console, using the backtick ` key, and enter the following command, "r.shadowquality" followed by a number. The higher number you input, the better the Modulated shadow will look at the expense of Frame Rate. In the following image, r.shadowquality was set to values of **0**, **1**, **2**, **3**, **4** and **5** to show what effect this has on the Modulated shadow quality.

Dragging the slider will show what happens when r.shadowquality is set from a value of 0 to a value of 5

  • Self Shadowing: Modulated shadows will provide self-shadowing on dynamic objects, like characters or pickups, however by default this feature was disabled to ensure that Modulated shadows could perform as well as possible. If your project can afford the extra cost self-shadowing requires, you can enable it by inputting r.Shadow.EnableModulatedSelfShadow 1 into the UE4 console. To disable self shadowing, input r.Shadow.EnableModulatedSelfShadow 0 into the UE4 console.

    Self Shadow On Self Shadow On

    Self Shadow Off Self Shadow Off

  • Shadow Depth: Using the command r.Shadow.CSMDepthBias you can offset the position at which the shadow starts to render. In the image below you can see what happens to the Modulated shadows when r.Shadow.CSMDepthBias is left at the default value of 0 and then set to values of 10 , 100 , 500 , 1000 and 1500 .

    Dragging the slider will show what happens when r.Shadow.CSMDepthBias is set from a value of 0 to a value of 1500

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss