Language:
Page Info
Tags:
Skill Level:
Engine Version:

Performance Guidelines for Mobile Devices

Choose your OS:

When developing for Mobile platforms, there are some things you should keep in mind when targeting specific devices or that are general good practices depending on the list of devices you want to release your title for. This includes developing with a specific lighting tier to get the most out of performance on a device and why a particular lighting tier may work best for your target audience. You'll also find some suggestions to keep in mind for any project you work on that will be developed with Mobile in mind.

Performance Tiers

Unreal Engine 4 (UE4) supports a variety of lighting features on mobile devices. Using these features costs performance and may cause your game to perform poorly on slower mobile devices. While it is possible to mix and match most of UE4's mobile lighting features, it can be useful to categorize these features into the following tiers. When building a mobile game, you should decide which features to use based on the quality of graphics your game requires and the types of devices you need to support. Check the compatibility page under iOS Development and Android Development for more information on what devices have been tested here at Epic and which tiers we think are most appropriate for that device.

LDR (Low Dynamic Range)

Low Dynamic Range (LDR) mode is the lowest performance tier supported in UE4 and is recommended for games that do not require lighting or Post Processing features.

To use this mode, you must disable Mobile HDR for your project in the Rendering section of the Project Settings .

DisableMobileHDR.png

Advantages

Limitations

Recommendations

  • Provides the fastest and lowest overhead mode available for mobile devices, which enables your game to run well on slower mobile devices.

  • Still provides full access to the Material Editor for defining custom shaders and even performing simple shading that can be used to fake lighting.

  • The scene's color is written out in gamma space with each color channel clamped to the range of [0,1].

  • Translucent primitives are blended in gamma space. In most cases, this will require you to author your translucent textures and Materials differently than you would in HDR or for a normal PC title.

  • Post Processing Feature are unavailable in this mode.

  • Make sure all of your Materials have their shading model set to Unlit for maximum performance.

  • Placed lighting should not be used in your scene when depending on maximum performance.

  • Consider performing as many operations in the Materials Vertex Shader as possible. You can do this by enabling Customized UVs, connecting nodes to them and then in the pixel shader using a Texture Coordinate node to target the customized UV.

Basic Lighting

In this tier, you will leverage Static lighting and fully rough Materials to create levels with interesting lighting while maximizing performance to reach a broader range of mobile devices.

To use this mode, you must disable Mobile HDR for your project in the Rendering section of the Project Settings .

DisableMobileHDR.png

Advantages

Limitations

Recommendations

  • Access to Static Lighting and Global Illumination features.

  • Full HDR pipeline with access to some Post Processing features, like Tone Mapping.

  • Translucency is blended in linear space, enabling you to author content as your normally would for Desktop.

  • Since all Materials need to be marked as Fully Rough, your Materials will not have interesting specular reflection.

  • If you choose to disable Lightmap Directionality, Normal Maps will have no effect.

  • Author all of your Materials with the Fully Rough flag set.

  • Consider disabling the flag for Lightmap Directionality in your Materials for additional performance.

  • Use only Static Lights in your maps.

  • Disable some Post Processing features completely, like Bloom. Also, stick to the basic set of film and color controls. See Mobile Post Process for more details.

Full HDR (High Dynamic Range) Lighting

In this tier, you take advantage of most of the HDR lighting features available for mobile in UE4, as well as some of the Post Processing features. Using these features requires quite a bit of performance in exchange for high-quality lighting features.

To use this mode, you must enable Mobile HDR for your project in the Rendering section of the Project Settings .

EnableMobileHDR.png

Advantages

Recommendations

  • Access to Static Lighting and Global Illumination features.

  • Full HDR pipeline with access to some Post Processing features.

  • Translucent is blended in linear space, enabling you to author content as you normally would for Desktop.

  • Realistic specular reflections on surfaces with support for varying roughness.

  • Consider enabling Bloom to take full advantage of the HDR lighting pipeline.

  • Realistic specular reflections in combination with HDR lighting can lead to specular aliasing. To reduce this effect, enable the Material property for Normal Curvature to Roughness to reduce specular aliasing due to high-frequency information in your normal map. You can also consider enabling anti-aliasing via the Project Settings > Rendering to help reduce the artifact.

  • Take time to consider the placement of Reflection Capture Actors to achieve the best results. See Reflections: Placing Reflection Captures for more information.

  • Use only Static Lights and Lightmaps in your scene for the best performance.

Full HDR Lighting with per-pixel lighting from the Sun

In this tier, you take advantage of all of the HDR lighting features available for mobile in UE4. This tier is the same as Full HDR Lighting and has the same advantages and recommendations with the exception that here you can add a single Directional Light to your scene that automatically uses per-pixel lighting for higher quality.

To use this mode, you must enable Mobile HDR for your project in the Rendering section of the Project Settings .

EnableMobileHDR.png

Advantages

Recommendations

  • All of the features and advantages listed for the Full HDR tier.

  • Per-pixel diffuse and specular lighting for a single Directional Light.

  • High-quality precomputed Distance Field shadows for a single Directional Light.

  • All of the recommendations and advantages of the [Full HDR](#fullhdr_highdynamicrange_lighting] tier.

  • Use only Static Lights in your except for a single Directional Light, which should be set to Stationary.

Shader Complexity View Mode

The Shader Complexity view mode in the Mobile Previewer to get a sense of what your Material costs will be for specific devices you are targeting. The colors indicated on screen will tell you how expensive the Material is for the device you're targeting; green means good performance, bright red means very expensive, and white or pink means that the Material is very expensive.

To use it, in the Main Viewport click the View Modes list and select Optimization Viewmodes and choose Shader Complexity, or you can use the keyboard shortcut Alt + 8.

Click for full image.

These are some examples taken from Mobile Sun Temple to give you an idea of Material cost when viewed using Shader Complexity:

1.png

2.png

3.png

The pillar Materials are fairly expensive here, and the translucent volumetric sheets are very expensive. In this scene, I asked to have the translucent sheets should be removed, as they cost too much.

Here the pillars are quite expensive as they use all five texture lookups and do quite a bit of layering. Otherwise, this is just about efficient enough for 30fps.

Here, the tree is causing pixels to be extremely expensive. If the player could ever get up close or cover the screen with that Material, the cost would be enormous.

Mobile Content Scale Factor

Mobile Content Scale Factor is a way to scale the resolution of your project to best fit the screen resolution of the mobile device being used to view your project. You can create and store multiple device profiles by creating a new configuration (.ini) file called DefaultDeviceProfiles.ini in your project's config folder.

Inside of this file, you can specify what will happen to the resolution of your project for specific devices by entering the following command followed by one of the values from the iOS and Android sections below:

r.MobileContentScaleFactor

In the following image, you can see an example of the Mobile Content Scale Factor being set in a configuration file:

Click for full image.

This particular configuration file is from the Tappy Chicken project and shows what will happen to the resolution of Tappy Chicken when it is played on various mobile devices. The top section of this file handles the resolution scaling for iOS devices and the bottom section handles resolution scaling for Android devices. Take note that each r.MobileContentScaleFactor has a number after it. The number is used after the command to determine if the project's resolution should be scaled up or down.

Mobile Content Scale Factor for iOS

For iOS devices, inputting the following numbers will produce the following results:

The iOS scale factor is directly related to Apple's scale factor system and the actual resolution for any scale factor other than 0.0 will be corrected to match the aspect ratio of the screen and clamped to the native resolution of the device.

Value

Result

0.0

This will use the native resolution of the device.

1.0

On a Retina device is the non-retina resolution.

2.0

Full native resolution on iPhone 5S, iPad Air, etc.

3.0

Full native resolution for iPhone 6+.

Mobile Content Scale Factor for Android

For Android devices, inputting the following numbers will produce the following results:

Please note that inputting values other than 0.0 will use this value as the scale factor for a standard 1280x720 or 720x1280 resolution depending on the orientation of the device.

Value

Result

0.0

This will use the native resolution of the device.

1.0

This will try and give you a resolution of 1280 x 720 for Landscape and 720 x 1280 for portrait.

2.0

This will try and give you a resolution of 2560 x 1440 for Landscape and 1440 x 2560 for portrait.

Mobile Material Quality Settings

When building content for a UE4 project that will run on both low and high-end mobile devices, you will often run into issues where a feature or your artwork is working on one set of devices but not another. While there are a lot of ways to address issues like this, many of these are both time and resource intensive which can be error prone at times. To address these types of issues UE4 has the Material Quality Level system. This system enables you to build one single Material that can then be used on a wide range of devices, giving you full control over which devices use which features.

In the following sections, we'll cover these systems and how you can use them in your own UE4 projects:

Previewing Material Quality Level

You can view what the different Material Quality Level settings will look like inside the Editor by going to the Main Toolbar and then then selecting Settings > Material Quality Level to choose the level you want to preview.

Click for full image.

The following images show what a Material will look like when the Material Quality Level has been set to Low, Medium, and High.

Dragging the slider will show what happens when changing the Material Quality Level from Low to Medium to High

Setting Material Quality Level

To set the Material Quality Level for your devices, you can do so in the following ways:

From the Console

Bring up the console by hitting the ` (backtick) key and entering r.MaterialQualityLevel followed by one of the following values:

MQS_Console_Command.png

Material Quality Level Number

Setting

0

Low

1

High

2

Medium

Please note that 1 for high and 2 for medium is correct and not a typo.

From Device Profiles

Using a configuration (.ini) file, you can set the Material Quality for the devices you plan to target using the following method from within the Editor:

  1. From the Main Toolbar go to Windows > Developer Tools and then click on Device Profiles.

    Click for full image.

  2. In the Device Profiles find the Android_Low profile and click on the first Wrench icon to open up the profile options.

    MQS_Edit_Profile.png

  3. In the Console Variables section under the Rendering option, click on the Plus icon and in the input window that pops up, input R.MaterialQualityLevel and then press the Enter key to add that command to the list.

    Click for full image.

  4. Once the new entry has been added, change the value from the default value from 1 to 0 so that when this project is viewed on lower end Android devices it will use the fastest possible Material settings.

    Click for full image.

Previewing Different Quality Levels

By adjusting the Preview Rendering Level, you can use the Unreal Engine 4 Editor to see how your project will look when running on different hardware. You can adjust this by going to the Main Toolbar and then select Settings > Preview Rendering Level and select the preview level you want to use.

Click for full image.

Material Quality Level Switch

The Quality Switch Material Expression enables you to define different levels of complexity within a single Material. For example, if you have a complex math operation, or heavy texture reads that will work on higher-end mobile devices but not on lower-end ones. You can use this node to specify simplified versions to be displayed on lower-end mobile devices that do not have the power to display higher-end graphics.

image08.png

To use the Quality Switch in your Materials, you will need to first add the Quality Switch Material Expression node to the Material Graph and then plug its output into any of the inputs on the Main Material node. In the following image, the M_Brick_Clay_Old Material (that can be found in the Starter Content) is setup so that when the Quality Level is switched, the complexity of the Material will be reduced.

Click for full image.

Mobile Material Options

If you open up any Material and click on the Main Material Node then look in the Details Panel under the Mobile section you will find the following two properties:

Property

Setting

Fully Rough

Forces a Material to be completely rough saving a number of instructions and a single texture sampler.

Use Lightmap Directionality

Uses lightmap directionality and per-pixel normals. If disabled, the lightmaps will be flatter looking visually but cheaper to use.

Click for full image.

These two properties can be enabled to help reduce the rendering cost of that Material when viewed on less powerful mobile devices by completely eliminating the rendering path for those features. However, this is, an all-or-nothing option as you either have these options enabled or disabled for this Material on all devices.

Mobile Material Rendering Overrides

You can override the available rendering option a platform will use by adjusting the the Material Quality settings for different target devices located under the Project Settings > Platforms.

PS_QualityLevels.png

Android:

  • Open GLES 2

  • Open GLES 3.1

  • Vulkan

iOS:

  • Open GLES 2

  • Metal

You can override the available rendering option a platform will use by adjusting the Quality Options listed. In order to use the overrides, you must first click on the Enable Quality Overrides option and then select the option you want to override for a given quality level.

EnableQualityLevelOverrides.png

Once all of the options you want have been selected, press the Update Preview Shaders button to recompile all the Materials to work with the options specified.

QualityLevelsUpdateShaders.png

Mobile Rendering Options

Inside of your Project's Settings menu under the Rendering section, you will find a number of properties that control how lighting and optimization will be handled inside of your mobile project. In the following sections we will take a look at these settings and what effect they will have on your project.

Accessing your Project's Settings

To access your project's settings you will first need to go to the Main Toolbar and then select Edit > Project Settings.

MRO_Project_Settings.png

Once the Project Settings menu is open, locate the Engine section and then click on the Rendering category. Use the following sections to adjust the settings below:

  • Mobile

  • Lighting

  • Mobile Shader Permutation

Click for full image.

Mobile Rendering Options

Under the Mobile category, you can set properties that directly affect the lighting and look of your mobile project. Read on below to explore these settings for your own projects.

MRO_Mobile_Settings.png

Property Name

Description

Mobile HDR

If true, mobile renders in full HDR. Disable this setting for games that do not require lighting features for better performance on slow devices.

Disable Vertex Fogging in mobile shaders

If true, vertex fog will be omitted from all mobile shaders. If your game does not use fog, you should choose this setting to increase shading performance.

Maximum number of CSM cascades to render

The maximum number of cascades with which to render dynamic directional light shadows when using the mobile renderer.

Mobile MSAA

This is the Multi-Sample Anti-Aliasing (MSAA) setting to use on mobile. MSAA is currently supported using Metal on iOS, and on Android devices with the required supported using ES2 or ES 3.1. If MSAA is not available, the current default AA method will be used.

Shader Reduction Settings for Mobile

Under the Lighting and Mobile Shader Permutation Reduction section, you will find a number of different option that can be enabled or disabled to effect shaders generated for Materials, which in-turn will reduce app size, save memory and improve load times.

MobileOptimizations.png

Property Name

spacer.png

Description

Lighting

The listed options found under the Lighting section of the Project Settings that should be adjusted for mobile performance.

Allow Static Lighting

Whether to allow any static lighting to be generated and used, like lightmaps and shadow maps. Games that only use dynamic lighting or that are unlit should set this to 0 to save some static lighting overhead.

spacer.png

Mobile Shader Permutation Reduction

The listed options found under Mobile Shader Permutation Reduction that should be adjusted for mobile performance.

Support Combined Static and CSM Shadowing

Allows primitives to receive both static and CSM shadows from a stationary light. Disabling will free a mobile texture sampler.

Support Distance Field Shadowing

Generate shaders for primitives to receive distance field shadows from Stationary Directional Lights.

Support Movable Directional Light

Generate shaders for primitives to receive movable directional lights.

Max Movable Point Lights

The number of dynamic point lights to support on mobile devices. Setting this to 0 for games which do not require dynamic point lights will reduce the number of shaders generated.

Use Shared Movable Point Light Shaders

If this setting is enabled, the same shader will be used for any number of dynamic point lights(up to the maximum specified above)hitting a surface. This is slightly slower but reduced the number of shaders generated.

spacer.png

Changing any of these settings will require you to restart the editor before they take effect.

If you disable a shader permutation that your lighting setup requires, your lighting or shadowing will not render correctly and there will be an on-screen message indicating the setting that needs to be re-enabled for it to work properly.

Additional Suggestions

The following suggestions will help to set up your content for optimal performance on mobile platforms. These are listed from most severe to least impactful.

  • Make sure lighting is built before running on a device.

  • Most Post Processing features are disabled for mobile platforms as they are too expensive, like like vignette or screen space reflections. Some GPU intensive features like Bloom and Depth of Field are enabled by default so that PC and mobile look the same but many features can cost 60 milliseconds or more with the default settings on some devices. The console command showflag.PostProcessing 0 can be used to turn off these features to get a general idea of their costs.

  • Make sure to use Precomputed Visibility and that it is set up properly. To do this, place Precomputed Visibility Volumes around areas where the player can walk or jump and then build lighting. You need to make sure to place these in the Persistent level that is used when building lighting and when running the game, so do not build a sublevel by itself. You can verify that Precomputed Visibility is working by entering the console command Stat Initviews on device or in the level previewer and making sure that Statically Occluded Primitives is greater than 0. Use the console command r.ShowPrecomputedVisibilityCells 1 to visualize the cells in the editor.

  • Use masked and transparent Materials sparingly. Only use them in places where they cover a small part of the screen. iOS devices are very optimal in shading opaque surfaces, as they will only shade each pixel once, but for masked and translucency, every single layer will have to be shaded. The total GPU time of a frame can be doubled or more by having overdraw. Use the Shader Complexity view mode to investigate any hot spots.

  • Draw calls of the entire scene should be <=700 for any single view. Areas with poor occlusion, like looking over a large landscape, is going to be biggest challenges for this. This can be seen with Stat OpenGLRHI on device or Stat D3D11RHI in the Previewer on PC.

  • Triangle count of the entire scene should be <=500k for any view. This has been determined to be the maximum poly count that can hit 30fps on both iPad4 and iPad Air. This can be seen with Stat OpenGLRHI on device or Stat D3D11RHI in the Previewer on PC.

  • Materials should use as few texture lookups and instructions as possible. You have five texture samplers available, but using all of those makes for a fairly expensive Materials. For now, use the PC instruction count to optimize and the Previewer shader complexity to visualize the total cost.

  • Only use independent texture fetches in Materials. This means UVs in the pixel shader (BaseColor, Roughness, etc.) must not be manipulated in any way, such as scaling. Use the CustomizedUVs feature instead to do the scaling in the Vertex Shader. Some special features like environment mapping require math on the UVs and that is OK for special cases.

  • It is recommended to use square textures as they have less memory waste. Always use power of two dimensions for these (256x256, 512x512, 1024x1024). Use the console command ListTextures in the Previewer to see where all the texture memory is going.

Tags