Unity Optimization: Understanding Texture Compression

Saharukh Mollah
2 min readMay 6, 2022

--

Whether you are working on an Application UI or a 2D or 3D game, texture compression plays a very crucial role in-game optimization. It sets the foundation for the build size of your game and gameplay smoothness.

So what does Texture compression helps us achieve?

  1. Reduce the build size - As it compresses texture files the size of the file reduces hence reducing the size of the build
  2. Decrease graphics memory usage- As the size of textures is reduced it takes less space in VRAM.
  3. Increase Graphics processing speed- Smaller Texture in VRAM takes less time to process hence GPU performance is improved.

Example of Texture Compression:

Uncompressed Texture.
Compressed Texture

So does texture compression comes with the loss of quality? If yes how we can manage it?

Yes, When we compress any image it leads to a loss of quality from the original image, in order to reduce the Loss of Quality we need to plug and play with compression size value and use the best for our project and for UI texture POT( Power of Two) Texture is preferred to be used.

What are these POT textures and why to use them?

POT & NPOT stand for ‘Power of Two’ and ‘Non-Power of Two’.

A POT texture is where a texture has a resolution of 2^n x 2^n (which means the height and width are either 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096.. etc).

NPOT is the reverse of this, a texture which does not have a height/width which is a power of 2.

The reason why POT textures are important is that unless the texture is POT you won’t be able to use some compression formats.

What are different compression formats and how do they work?

Texture Compression Format is the format in which your texture will be compressed to. Your Compression Format will be depended on the platform you are building on. And it is always advisable to stick to one texture compression format throughout your project.

You can read more about the formats here : https://docs.unity3d.com/Manual/class-TextureImporterOverride.html

--

--