Search Unity

Questions about Compression Formats: ETC2, Crunch, etc.

Discussion in 'General Graphics' started by Zythus, Jan 7, 2018.

  1. Zythus

    Zythus

    Joined:
    Jun 28, 2014
    Posts:
    30
    Hey guys, first of all I'm not sure if it is the right place to post this, so if it isn't redirect me into the right place. Thank you.

    Using Resource Checker I saw that I was using RGBA Compressed ETC2 8 Bits on 90% of my textures. However, fiddling with the settings, I noticed major differences in size after changing the format: in most cases with objects where I didn't need transparency (dropped 50% of size).

    Now, I've got 2 questions. From what I've read some formats are incompatible (DXT), some don't use Alpha (which saves sizeable amounts of data which is nice) and some are not as faithful as other.

    My first question is: which is the best format for textures in a game designed for Android? My focus here is 512 resolutions tops (mostly lower), stable 60fps and for the textures to work on as many devices as possible.

    Right now I set my textures to RGB Compressed ETC 4 bits (for the textures without alpha), and RGBA Compressed ETC2 8 bits (textures and sprites with alpha).
    But here is my second question: what is this Crunch thing and is there a huge difference between formats below in terms of performance on mobile? I believe that size difference is significant, but I'm actually curious about the performance side.

    Here is the size of one 512 res file overridden with different formats for Android (lowest compressor quality):
    RGB Crunched ETC 13.8KB
    RGBA Crunched ETC2 11.5KB (sic! How is a format with alpha smaller than one without?)
    RGB Compressed ETC4 128KB
    RGBA Compressed ETC2 8 bits 256KB
     
    Last edited: Jan 7, 2018
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    Crunched is a secondary on disk compression. It'll reduce the size of your game on disk, but on the GPU. On the GPU it'll be the same as the non-crunched version, potentially with some additional artifacts.
     
  3. Zythus

    Zythus

    Joined:
    Jun 28, 2014
    Posts:
    30
    So all crunch does is compress textures saving size but there is a higher chance of artifacts appearing?
     
    Last edited: Jan 8, 2018
  4. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    295
    Yes, it is a lossy compression format.
     
  5. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,778
    Would crunch have any impact on runtime performance, load times etc?
     
  6. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    There's no impact on runtime performance as the textures are decompressed on load into DXT or ETC formats, and at that point are identical to the uncrunched equivalents as far as the GPU is concerned.

    Load time wise, while the decompression step does take a little time, the overall load time shouldn't be affected much, or may even be reduced. This is due to the smaller asset size taking less time to read hiding the decompression time compared to uncompressed. This is the reasoning behind crunch compression at least.
     
    DankalApps and Antony-Blackett like this.
  7. kodekq

    kodekq

    Joined:
    Sep 27, 2014
    Posts:
    23
    That is, at boot time, crunched to non-crunched is decompressed by CPU?
     
  8. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,019