Texture size, color space, and compression can all have an impact on the performance of your game.
Only create textures that are large enough to meet the required quality, but no bigger. It is also best practice to use a large-size texture atlas that contains several textures that are shared between many meshes.
Textures can be different sizes. Reducing the size of certain textures that require less detail helps to reduce bandwidth levels. For example, the diffuse texture can be set to 1024x1024 pixels and the roughness, or metallic, map to 512x512 pixels.
Selectively reduce the texture size and check whether any of the visuals have been degraded afterwards.
Texture color space
Most texturing software, for example Adobe Photoshop or Substance Painter, works and exports using the sRGB color space.
We recommend that you try the following:
- Use diffuse textures in the sRGB color space.
- Textures that are not processed as color must not be in the sRGB color space. Examples include metallic, roughness, and normal maps. This is because of the following reasons:
- Maps are used as data, and are not used as color.
- Using sRGB in these maps results in the wrong look, or visual, on the material.
Note: The sRGB (Color Texture) setting in the Inspector window for the texture must not be ticked for roughness, specular, normal maps, or similar.
The following screenshot shows you what happens when sRGB is incorrectly applied to such a texture:
Texture compression is an image compression that is applied to reduce texture data size, while minimizing the loss in visual quality. In development, we export textures using a common format, like TGA, or PNG. These formats are more convenient to use, and major image software programs support them.
These formats must not be used in final rendering. This is because they are slower to both access and sample, when compared to specialized image formats. For Android, there are several options, like Adaptive Scalable Texture Compression (ASTC), Ericsson Texture Compression (ETC) 1, or ETC2.
Texture compression best practices
We recommend that you use the ASTC technology that Arm created. Here several reasons to use ASTC:
- ASTC gives better quality with the same memory size as ETC.
- ASTC produces the same quality with a smaller memory size than ETC.
- ASTC takes longer to encode than ETC. This means that game packaging process can take more time. If this is an issue, then it is better to use ASTC on the final packaging of the game.
- ASTC allows for more control in terms of quality, because ASTC allows the block size to be set. While there is no single best default for block size, setting the block size to 5x5 or 6x6 pixels is a good starting point.
Sometimes, it might be faster to use ETC for development if you have to quickly deploy your game on a device. You can use ASTC with fast compression settings to get around the increase in deployment time. When encoding, there are options to trade off speed against both quality and size. For the final build, ASTC is the best option in terms of balance between visual quality and file size.
The game engine handles the texture compression when you package the game. However, you can choose which compression technique to use. You must choose the format to use, so it is difficult to skip this step.
The following screenshot shows how to select ASTC when building an Android package in Unity:
The following image shows both the difference in quality, and the respective file size between ETC and ASTC compression: