Search Unity

Texture compression for Android devices

Discussion in 'Editor & General Support' started by VLukianenko, Feb 6, 2018.

  1. VLukianenko

    VLukianenko

    Joined:
    Mar 27, 2017
    Posts:
    30
    Hello everyone!
    When I was building my game I noticed that I got thousands of messages like:

    > WARNING: DXT texture format is not supported, decompressing texture
    > WARNING: ASTC texture format is not supported, decompressing texture
    > WARNING: ETC2 texture format is not supported, decompressing texture


    And it seemed that builder returned uncompressed textures into the build, pumping up the size of the apk. I started investigating into compression formats, how they work and where they are supported, but most of the articles are from 2013 or 2015, and in modern days of technology, 3 years might change a lot.

    It seems that DXT5 compression gives best results in my case, but it is written that it's not supported on all android devices, but I've never found any statistics or reports on which exactly.
    ETC2 is written to be supported by almost all android devices, but also that it doesn't support alpha. Weird to read that in 2018.
    ASTC seems to give nice results for NPOT (non-power of two) textures, but looks like it also has limited support.

    Now, my questions are:
    1) What is the current situation with DXT support on Android? I've built my game on MALI-400MP4 (a year 2008 gpu), Mali-T880 and Ardeno 505 - all of them worked fine.
    2) Since GPU above worked fine, next question: if the compression is not supported on a device, what happens? Does the texture gets decompressed into RGBA 32 on CPU and then passed to GPU making everything slower, or do I get some kind of graphical glitches?
    3) What should I do to ensure the most efficient way to store and process texture data in my mobile game? I know that textures should be in the size of powers of 2, packed in atlases, no alpha where possible and the size should be overridden platform specifically. Is there anything else I can do? Should I use external compressors, and not Unity default? (Since I get thousands of error messages that compression is not supported)

    Also, if you have any other general advises, I'll welcome them. Thanks!
     
    honor0102, BuzzKirill, r137 and 4 others like this.
  2. silkms-bf

    silkms-bf

    Joined:
    Feb 26, 2016
    Posts:
    12
    @VLukianenko ... these are all great questions! I am wondering if you have found answers or best practices etc... and what resources you found useful.

    Thanks in advance!
     
    valentin56610 and honor0102 like this.
  3. VLukianenko

    VLukianenko

    Joined:
    Mar 27, 2017
    Posts:
    30
    Funnily enough, I stopped having these questions since my game has been discontinued :)
    I don't know what's the answer on 1st question. And I ended up thinking that my second question is what happens with unsupported texture compression: they are decompressed on CPU and then sent to GPU as large files, making compression basically useless - so it's best to use native compression, even if other type gives smaller file size.
    As for the third part, my current opinion is that if you want to reach large amount of different devices of same platform, you might want to use asset bundles to send correctly resized and compressed textures to target devices, and in this way control their memory usage. (i.e. send much worse textures on old devices)

    However, though, I still would love to have these questions answered with links and documentation, as all said above I sourced from: "trust me dude".
     
    honor0102 and white_hunter like this.
  4. stgs73

    stgs73

    Joined:
    Mar 23, 2015
    Posts:
    59
    ETC1 is supported by all Android devices but does not support Alpha. Unity added a check box to enable split alpha channel. This creates a separate alpha tex which is combined at runtime although we had to override the Unity UI Image.cs to get it to work properly. In the older sprite packer, these also needed to be set with an atlas tag which is a bit annoying.

    ETC2 is supported by most ( not all ) GL ES 3.0 Android devices - if it isn't supported it is decompressed to 32bit

    In new version of unity, it looks there are a few more fallback options now if ETC2 is not supported

    As for DXT/ASTC, i think those are very specific to certain chipsets...see here

    https://docs.unity3d.com/Manual/class-TextureImporterOverride.html

    I haven't used the new sprite atlas system or the new compression formats like crunched.

    Also re: comment on "I know that textures should be in the size of powers of 2, packed in atlases", the atlas should ideally be a power of 2 to support compression but the contents do not need to be power of 2 if they are on an atlas..
     
    honor0102, Rachan and VLukianenko like this.