Use optimized shaders for mobile

Unity have collections of shaders targeted for mobile platforms, which are conveniently located in the mobile category. Use these shaders whenever possible for mobile game development.

  • These shaders contain a lot of feature simplifications, enabling them to have a better performance on mobile based platforms.
  • This means that there will be less features compared with a standard shader, such as no color tinting.
Unity Mobile Preview 

Unreal Engine will use the most relevant mobile shader depending on the target platform selected. Using this mobile shader will result in a different look compared with the default Shader Model 5. You need to change the Preview Rendering Level to better visualize the final look in the device within the editor. Unreal Engine's material on mobile platforms is created using the same process with other platforms, so they generally have similar visuals and behaviors.

Unreal Engine Preview 

Only use features that are needed. Unity and Unreal Engine compile the shader based on the material settings, and by removing features that are not needed (such as colour tinting, detail map, etc) we will have an overall less complex shader that can potentially help with performance on mobile platforms.

Use a fewer number of texture sampler in a material

For mobile platforms, the general rule of thumb is to use as few textures as possible. This is because more textures will likely result in more texture fetches, which means more bandwidth that will most certainly affect battery life. Also, as these textures need to be saved in memory, it will increase the application size considerably.

  • In Unreal Engine, the recommended maximum number of texture samplers for mobile are five -
  • It is still advisable to use the least amount of textures possible, as using all five texture samplers in a material will make it considerably more expensive.
  • Using texture packing will help to reduce the number of textures. Instead of using individual textures for the roughness/metallic, we can pack them into channels of a single texture.
Texture Packing 

We can also use a numerical value instead of a texture for some parameters, such as metallic or roughness/smoothness (do this if possible and observe whether it will affect the visual quality), as this will further reduce the number of textures used.

  • In Unreal Engine, this is done by adding constant to the parameter slots. In Unity, a value needs to be added within the shader.

Using an unlit shader will also reduce the number of textures used, as the material is not affected by light; therefore, it will not need roughness or metallic texture.

An unlit shader is cheaper then lit

When creating a shader, we can decide how the material will react to light. Most commonly used in mobile games are either lit or unlit shaders.

Unlit - fastest/cheapest shading model. Use this if targeting lower-end devices.

  • Use an unlit shading model as much as possible, especially if the game is targeting lower-end devices.
  • Unlit shading model, as the name implies, is not affected by lighting and only output emissive as color. 
  • As it is not affected by light, many calculations are not needed, such as specular, shadow, etc., resulting in cheaper/faster rendering.
  • Going with stylized/cartoony art direction works really well with unlit shading and should be considered when making games for mobile platforms.

Default lit - will need extra processing compared with unlit.

  • More processing needed for this compared with unlit, but will enable the surface to be affected by light and have specularity. 
  • For most games this is probably the shading model that is most used.

A comparison between Lit and Unlit can be seen below, same tower mesh and texture set applied using different shader. Unlit is not affected by lights and, in turn, needs less computation because of it. This will potentially result in a better gaming performance.

Lit and Unlit
Previous Next