Back to the Basics

Looks like we are in trouble. Storage size is a priority. Memory consumption is also a priority. And we cannot sacrifice quality for that. What could go wrong?

What if we could have a way to maintain quality while decreasing storage size? 32 bits per pixel is too much. Maybe 16 bits per pixel will suffice.

Let’s try it!

In the figure below, you have the same texture set as RGBA8888 (RGBA 32 bits in Unity) on the left and as RGBA4444 (RGBA 16 bits in Unity).

Reducing bits per pixel (nearest color — no dithering)

As you can clearly see, the quality of the right texture is not acceptable either. But size is quite good. Obviously, dividing by 2 the bit count per pixel decreased accordingly the storage size. Now, is there a solution to keep quality on par (or almost)? No, but YES!

No, because Unity has a poor support for 16 bits textures. The conversion algorithm makes a simple bit count reduction to the nearest color.

But yes, a big YES, thanks to Texture Packer. Other tools with such capability may exist, but I’m biaised. Texture Packer is packed with so much useful stuff. And it has a command-line interface for easy automation!

Reducing bits per pixel (FloydSteinbergAlpha dithering)

Texture Packer allows you to choose among several algorithms to convert your 32 bits texture to formats like RGBA4444 (16 bits textures with alpha), RGBA5551 (16 bits textures with punch-through alpha) or RGB565 (16 bits textures without alpha) among others, with or without dithering. In this case, I used the FloydSteinbergAlpha algorithm which produces dithering. Of course, the above picture exhibits artifacts related to this dithering. But with reduced versions shown below (or on high pixel density screens), you can clearly see the benefits and barely perceive the differences, while the “nearest color” version still looks bad.