About texture compression / profiles

What has Defold team found are best practices per target iOS and Android?


Oh, good question! This is the domain of @sven, @Andreas_Tadic and @Mathias_Westerdahl. Maybe also @Andreas_Jirenius since Blossom did quite a lot with different texture profiles on mobile.


It’s a good question! Will be great if somebody can help with it.


Support for these were added after this question was asked (I believe), and they are supposed to be really great.

I have not done tests for the different compression levels available, but it would be a good idea to do that some time to see the differences in relative quality and size.

I imagine that most used assets would would want to be as shiny looking as possible, less compression, and then have rarer, less important elements more compressed. So, if you had a match 3, you would want your board pieces to look as good as possible so that they are crisp and highly detailed in game, but your world map assets could be compressed a bunch.

I’d still like more up to date info on this, which formats we should be using and why too.

1 Like

I looked up some information about the formats and compression types. Please correct me if I’m wrong.

compression_type has to do with final binary size compression. COMPRESSION_TYPE_DEFAULT uses LZ4 while the other two use webp either lossless or lossy. There are various articles about the advantages webp has over jpeg for lossy compression and over png for lossless compression. I don’t know a reason to not use webp over default LZ4 ever.


Could we get metrics for what values the compression_level options correlate with for quality levels?

format has to do with how much memory is used in your running app. TEXTURE_FORMAT_RGB (192 KB in memory for a 256x256 texture)/TEXTURE_FORMAT_RGBA (256 KB in memory for a 256x256 texture) are uncompressed, and ideal for elements you want uncompressed and fully attractive always. The A means alpha channel or not, so without A means for an image with no transparency. The PVRTC options also support RGB/RGBA and are either 2 bits per pixel (16 KB in memory for a 256x256 texture) or 4 bits per pixel (32 KB in memory for a 256x256 texture)

There is some more info on the official docs here, I looked elsewhere for the estimates for memory usage per various formats http://www.defold.com/manuals/texture-profiles/

PVRTC is supported on iOS. If you use PVRTC on Android they will be uncompressed fully, I believe. There is ETC1, but it’s for RGB only and not RGBA. Still if you are targeting Android with non-alpha images ETC1 is what you want. So we can probably expect at runtime for Android builds to always take up more memory than ideal iOS builds… I don’t know enough about these formats to give perfect answers so I’m probably wrong about some of these.

Luckily texture profiles makes this all easy for per target platform texture compression options for sets of files!

PVRTC should not be used for sprites or pixel art. It will produce artifacts.

What’s the main use case for TEXTURE_FORMAT_LUMINANCE?

There should probably eventually be added support for 16 vs 32 bit uncompressed textures in memory?

There are newer formats such as ASTC but only support newer iOS device models.


BUMP on this very interesting topic.

From your experience, what are the best compression profiles for Android/iOS?

I use webp lossy for certain things and webp for others, the main way I control overall size is by adjusting max texture size. Remember that in texture profiles you want to put the most specific first in the list and most generic last in the list, which means you’ll possibly want to edit it directly in a text editor to fix the order.

PVRTC / ETC lossy formats specific to iOS (PVRTC)/Android(ETC), you don’t select webp lossy for them you select webp.

Check the list of the specific formats here for your needs.

When doing release builds you may want to use best compression instead of fast.

You’ll want to experiment with compression too. I recommend making a minimal project with assets you want to test and deploying that to the device to test how they look instead of doing your whole project over and over again since that can take ages.

Certain key assets / art I do not compress and also allow to have 1:1 atlas sizes since their clarity is important to the overall presentation of the game.

You can target both Android and iOS (plus other platforms) in the same texture profile file.

Here is an important related thread