Texture size, color space and compression
For textures that are not shared with others, it is best to have them as small as possible, or just big enough to achieve the desired quality. Having a large size texture atlas containing multiple textures that's shared between many meshes is also favourable.
Not all textures need to be the same size.
- Reducing size of certain texture (one with less detail) will help bandwidth.
- For example diffuse texture may be set to 1024x1024 and roughness/metallic map to 512x512.
- This need to be done selectively and observe if there are noticeable visual impact when applying this.
Texture color space
Most texturing software (Adobe Photoshop, Substance Painter) work and export using sRGB color space.
- Diffuse texture should be in sRGB color space.
- Textures that are not processed as color should NOT be used in sRGB color space (such as metallic, roughness, normal map, etc).
- This is because these map are used as data or unit, not color.
- Using sRGB in these maps will result in wrong look/visual on material.
Texture compression is an image compression applied to reduce texture data size, while keeping the visual quality impact minimal. In development scenarios, we export out texture using common format (such as TGA, PNG, etc) to work with, as they are more convenient to use and widely supported by various software. These formats are not used in final rendering as they are slower to access/sample compared with certain specialized format, for mobile (Android) there are several options to go with such as ASTC, ETC1, ETC2...
Texture compression best practices
- We may get better quality with same memory size as ETC.
- Or same quality with less memory size than ETC.
- ASTC takes longer to encode compared to ETC and might make the game packaging process take longer time. Due to this, it is better to use it on final packaging of the game.
- ASTC allows more control in terms of quality by allowing to set block size. There are no single best default in block size, but generally setting it to 5x5 or 6x6 is good default.
In some cases it might be faster to use ETC for development to quickly deploy on device. However, we can use ASTC with fast compression settings to get around this. Sometimes the regular encoding time without faster compression settings needed for ASTC can be longer. For the final build ASTC is a better option in term of balance between visual quality and file size.
Texture compression is handled by the game engine when we package the game. But we can choose which one to use.
- On Unity and Unreal, texture compression is all handled by the engine when we package the game and we need to choose format to go with so it is difficult to skip this step.
- Unreal has a feature to package with all texture formats and the engine will choose which format to use based on the device. This will result in larger packaged file but avoid compatibility issues.
ASTC and ETC image comparison