Material and Shader Best Practices for Artists


Overview Shader and Materials Hints and Tips Transparency Best Practice

Use optimized shaders for mobile

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

  • These shaders contain a lot of feature simplification to enable them to have better performance on a mobile based platform.
  • In Unity this means that there will be less features compared with a standard shader, such as no color tinting.

Shader Unity Mobile

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. We 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 platform, so they generally have similar visuals and behaviors.

Shader Unreal 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 platform 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 application size considerably.

  • In Unreal Engine the recommended maximum number of texture sampler for mobile are 5 - https://docs.unrealengine.com/en-US/Platforms/Mobile/Materials/index.html
  • It is still advisable to use a smaller number of textures as possible, as using all 5 texture sampler in a material will make a considerably expensive material.
  • Using texture packing will help to reduce number of textures. Instead of using individual textures for the roughness/metallic, we can pack them into channels of a single texture.
  • 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 visual quality), this will further reduce number of textures used.
    • In Unreal Engine, this is done by adding constant to the parameter slots, in Unity we need to add a value within the shader.
  • Using an unlit shader will also reduce number of texture used as material is not affected by light, therefore will not need roughness or metallic texture.

Shader Texture Packing

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 low 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 implied, 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 work really well with unlit shading and should be considered when making game for mobile platform.

Default lit - then it 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 better performance of the game.

Lit and unlit example

Previous Next