Search Unity

Gradient-friendy dither options for RGBA-16 asset compression

Discussion in 'Editor & General Support' started by Pixelsprite, Oct 8, 2014.

  1. Pixelsprite

    Pixelsprite

    Joined:
    Dec 12, 2013
    Posts:
    24
    Hello!

    Does anyone know if more filters exist for RGBA32->RGBA16 conversion from inside Unity?

    I suspect that Unity is using either Nearest Neighbor or Linear when compressing texture to the RGBA16 choice, which is really bad for the majority of our textures, especially those with lots of transparency. I would rather use Floyd-Steinberg Alpha or Atkinson.

    Before working with Unity, I was using TexturePacker which has the above dither options. Here is an example so that you can see the difference:

    upload_2014-10-8_17-1-17.png

    As you can see the Floyd-Steinberg dither of Texture packer (Middle) better preserve the gradients.

    I know that I could just use TexturePacker and import RGBA16 directly, but this has some drawbacks: 1) Unity just compresses it again (but still looks better) 2) Binds us to RGBA16 for all platforms (I'd rather use DXT5 for some) 3) Another chain in the pipeline.

    I could not find a relevant plugin with Floyd-Steinberg/Atkinson filters in the Asset Store. If no such filters exist, do you think it is possible that we could extend the editor/compression options to write our own?

    Thank you!
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,794
    It would be worth to ask for it as a feature at : http://feedback.unity3d.com/

    Make sure to post the link back here, I would certainly give some votes.
     
  3. Pixelsprite

    Pixelsprite

    Joined:
    Dec 12, 2013
    Posts:
    24
  4. Pixelsprite

    Pixelsprite

    Joined:
    Dec 12, 2013
    Posts:
    24
    Just thought I'd post our temporary solution to this problem:

    Since I could not find a way to add a new compression option to the Unity pipeline (for example ARGB 16 with Floyd-Steinberg), I now use the following technique, which gives better results than the Unity default compression:
    1. Re-export all Atlases with transparency to RGBA 4444 with Floyd-Steinberg Alpha from Texture Packer. This is a breeze with Texture Packer command line.
    2. Import them as usual to Unity. Expect grumbles and maybe unlinked NGUI prefabs.
    3. Change compression settings for those textures to RGBA16.
    4. Unity applies its own ‘compression’ but since the image is already dithered, Unity’s compression does not do as much damage.
    5. Build to device as usual, without glaringly horrible gradients. Even our picky and pixel-hunting Art Director is happy with this solution.
    Here is a screenshot comparing the different approaches, so that you can see what our quasi-solution is achieving. Even if i use DXT5 as compression option, it works well.

    Hope that will help somebody else too at least until we have an officially supported dither compression.
     
    Nith666 likes this.
  5. Nith666

    Nith666

    Joined:
    Aug 1, 2012
    Posts:
    57
    @Pixelsprite Cool solution, looks WAY better now, thanks!
     
    Pixelsprite likes this.