Language:
Page Info
Tags:
Engine Version:

Performance Guidelines for Mobile Devices

Below are things to watch out for or suggestions on how to set up your content to maximize performance on mobile platforms. These are listed from most severe to least.

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

  • Make sure most Post Process features are disabled. In fact, the only ones you can use for iPad4 are Temporal AA and the Film ones, including vignette. A bunch of expensive features like Bloom and DOF are enabled by default as we have the same settings between PC and mobile. Post Process features can easily cost 60+ms with the default settings. We hope to be able to use DOF and light shafts on higher end devices. The console command show postprocessing can be used on devices to toggle Post Processing and see how much it is costing.

  • Make sure Precomputed Visibility is setup properly. To do this, you need to place Precomputed Visibility Volumes around anywhere that the player can walk, and then build lighting. You need to make sure the same Persistent level is used when building lighting and when running the game (aka do not build the sublevel by itself). You can verify that it is working by entering stat initviews on device or in previewer and make sure the Statically occluded primitives is > 0. Use r.ShowPrecomputedVisibilityCells 1 to visualize the cells in the editor.

  • Use masked and translucent Materials sparingly, and only 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, most of the time. But for masked and translucency, every single layer will have to be shaded. The total GPU time of a frame can easily be doubled or more by having overdraw. Use the Shader Complexity Viewmode in Mobile Previewer to investigate hot spots.

  • Draw calls of the entire scene should be <=700 for any view. The areas with poor occlusion, like looking over the landscape, are going to be the biggest challenges for this. This can be seen with stat openglrhi on device, stat d3d11rhi in ES2 previewer on PC.

  • Triangle count of the entire scene should be <=500k for any view. This has been determined to be the poly count needed to hit 30fps on both iPad4 and iPad Air. This can be seen with stat openglrhi on device, stat d3d11rhi in ES2 previewer on PC.

  • Materials should use as few texture lookups and instructions as possible. You have 5 texture samplers available, but using all of those makes for a fairly expensive Material. For now, use the PC instruction count to optimize, and ES2 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.

  • Prefer square textures as they have less memory waste, and always use power of 2 dimensions (512, 1024, 2048). Use listtextures in the ES2 previewer to see where all the texture memory is going.

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 device compatibility pages under iOS Development and Android Development for more information on what devices we have tested here at Epic and which tiers we think are most appropriate.

LDR (Low Dynamic Range)

Low dynamic range or LDR mode is the highest 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 Editor .

Advantages

  • The fastest and lowest overhead mode available for mobile devices. Enables your game to run well on slower mobile devices.

  • Still provides full access to the Material editor for defining custom shaders and even perform simple shading to fake lighting.

Limitations

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

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

  • Post Processing features are unavailable in this mode.

Recommendations

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

  • Do not place lights in your scene or otherwise depend on lighting for maximum performance.

  • Consider performing as many operations in the Material's vertex shader as possible. You can do so by enabling Customized UVs, connecting nodes to them, and reading them in the pixel shader using a Texture Coordinate node.

Basic Lighting

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

Advantages

  • 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 allowing you to author content as you normally would for any other UE4 game.

Limitations

  • As you are marking all Materials as Fully Rough, your Materials will not have interesting specular reflections.

  • If you also choose to disable lightmap directionality, normal maps will have no effect.

Recommendations

  • Author all of your Materials with the fully rough flag set.

  • Consider disabling light map directionality in your Materials for additional performance.

  • Use only static lights in your maps.

  • Disable bloom and anti-aliasing. Also, stick to the basic set of film and color controls. See mobile Post Process for more details.

Full HDR 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.

Advantages

  • Access to static lighting and global illumination features.

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

  • Translucency is blended in linear space allowing you to author content as you normally would for any other UE4 game.

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

  • Full support for normal mapped surfaces allows interesting surface detail without adding a lot of polygons to your meshes.

Recommendations

  • 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. You should take advantage of the normal map to roughness feature to help reduce specular aliasing due to high frequency information in your normal map. You should also consider enabling anti-aliasing in the Post Process volume to help reduce this artifact.

  • Taking time to consider the placement of Reflection Captures will help you get the best results. For more information check out the Reflections: Placing Reflection Captures .

  • Use only Static Lights and Lightmaps in your scene for 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 the 'Full HDR Lighting' tier and has the same advantages and recommendations except that a single directional light is rendered at much higher quality.

Advantages

  • All of the features and advantages of the Full HDR Lighting tier.

  • Per-pixel diffuse and specular lighting for a single directional light.

  • High quality precomputed distance field shadows for a single directional light.

Recommendations

  • All of the recommendations for the Full HDR Lighting tier apply here.

  • Use only static lights in your scene except for a single directional light that you should set to be stationary.

Shader Complexity View Mode

You can use the shader complexity view mode in the PC ES2 previewer to get a sense of Material cost. To use it, just enter viewmode shadercomplexity in the console in the PC ES2 Previewer. Just like the SM5 shader complexity, green means good performance, bright red means very expensive, white or pink means extremely expensive. Here are some examples from the mobile showcase:

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 removed, as they cost too much.

Here the pillars are quite expensive as they used all five texture lookups and did 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 his 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 .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 by entering the following command.

 r.MobileContentScaleFactor = 

In the following image, you can see an example of the Mobile Content Scale Factor in action using the command listed above.

Click for full image.

The image above was taken from the UE4 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 the file handles resolution scaling for iOS devices, and the bottom section handles resolution scaling for Android devices. Make sure to note that each r.MobileContentScaleFactor has a number after it. The number that is used after the command is what determines if the projects resolution should be scaled up or down.

Mobile Content Scale Factor for iOS

When using Mobile Content Scale Factor for iOS devices inputting the following number after the r.MobileContentScaleFactor will produce the following results. Please note that 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 native resolution.

The iOS scale factor is directly related to Apple's scale factor system.

Command Value Result
r.MobileContentScaleFactor 0.0 This will use the native resolution of the device.
r.MobileContentScaleFactor 1.0 On a Retina device is the non-retina resolution.
r.MobileContentScaleFactor 2.0 Full native resolution on iPhone 5S, iPad Air, etc.
r.MobileContentScaleFactor 3.0 Full native resolution for iPhone 6+.

Mobile Content Scale Factor for Android

When using the Mobile Content Scale Factor for Android devices inputting the following number after the r.MobileContentScaleFactor will produce the following results. Please note that inputting value other than 0.0 will use this value as the scale factor for a standard 1280x720 or 720x1280 resolution depending on orientation.

Command Value Result
r.MobileContentScaleFactor 0.0 This will use the native resolution of the device.
r.MobileContentScaleFactor 1.0 This will try and give you a resolution of 1280 x 720 for Landscape and 720 x 1280 for portrait.
r.MobileContentScaleFactor 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 an Unreal Engine 4 (UE4) project that will run on both low and high end mobile devices you will often run into issues with certain features working on one set of devices but not working on another set of devices. You also might encounter issues with your artwork looking correct on one device but completely different on another. While there are a lot of ways to address problems like this, many of theses ways are both time and resource intensive and also extremely error prone. To address these issues UE4 has the Material Quality Level system. This system allows you to build one single Material that can then be used on a wide range of different devices, giving you full control over which devices use which features. In the following sections we will go over these systems and how you can use them in your UE4 projects:

Previewing Material Quality Level

You can view what the different Material Quality level settings will look like inside of the UE4 Editor by going to the Main Toolbar and then going to Settings > Material Quality Level and selecting the quality 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 and High

Setting Material Quality Level

You can set the Material Quality Level in the following ways inside UE4:

From the Console: You can set the quality level that your Materials will use in the Editor by pressing the Backtick key to open up the UE4 console and entering r.MaterialQualityLevel followed by one of the following numbers.

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: You can also adjust the Material Quality by doing the following:

  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

You preview from the UE4 Editor how your project will look when running on different hardware by adjusting the Preview Rendering Level. You can adjust this by going to the Main Toolbar and then go to 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 allows 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 mobile devices 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 it's output into any of the inputs on the Main Material node you want to change when the quality level is changed. In the following image, the M_Brick_Clay_Old Material that can be found with the Starter Content was set up so that when the Quality Level is switched the complexity of the Material is 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.

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

  • Use Lightmap Directionality: Uses lightmap directionally and per pixel normals. If disabled, the lightmaps will be flatter but cheaper.

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 ES2 Quality Settings. You can find the ES2 Quality Setting for both Android and iOS by going to your Project Settings > Platforms and then selecting either Android ES2 Quality or iOS ES2 Quality Settings. To use the overrides, you must first click on the Enable Quality Override option and then select the option you want to override by clicking on it. Once all of the options you want have been selected, press the Update preview shaders button to re-compile all Materials to work with the options you have specified.

Click for full image.

Mobile Rendering Options

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

Accessing your Project Settings

To access your project 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 and look for the Mobile heading.

Click for full image.

Mobile Rendering Options

Under the Mobile section you will find a number of different options that can be enabled or disabled. In the following section we will take a look each one of the properties and the effect they will have on your mobile project.

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.
Max Dynamic 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 shader generated. Changing this setting requires restarting the editor.
Use Shared Dynamic 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. Changing this setting requires restarting the editor.
Enabled 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.
Tags