Home Technical Talk

iOS PVRTC Compression terribly for RGBA

polycounter lvl 4
Offline / Send Message
echofourpapa polycounter lvl 4
I have noticed something recently, and that is PVRTC RGBA basically destroys the texture.

Are there any good RGBA texture compression formats for iOS?

Replies

  • fmnoor
    Options
    Offline / Send Message
    fmnoor polycounter lvl 17
    It's PVRTC or bust for iOS - because that's the chipset. Could you define "destroy" ? You can definitely tweak the settings. I've used PVRTexTool in the past: http://community.imgtec.com/developers/powervr/tools/pvrtextool/
  • echofourpapa
    Options
    Offline / Send Message
    echofourpapa polycounter lvl 4
    I will post an example soon, but basically as soon as I add an alpha channel I get a lot of red and yellow splotches all over.  Completely ruins a normal map if I want stick height in the alpha, but the same noise pretty much ruins all other things. 

    I've been using PVRTC 4bits RGBA(not PVRTC II).  

    This noise isn't there in PVRTC 4bits RGB.  It's only when I introduce an alpha channel.
  • fmnoor
    Options
    Offline / Send Message
    fmnoor polycounter lvl 17
    I do remember PVRTC being really finnicky when it comes to certain things. It might be an issue with whatever you're using not saving the channel order correctly.

    Try out the PVRTexTool and see if saving out the normal map manually (with you making sure the channel order is correct) with that and see if it helps.. and of course make sure you have a square texture etc - which you probably are doing (but hey it doesn't help to double check). But yea, would love to see what the issue looks like when you have the chance to post it
  • codyaq2
    Options
    Offline / Send Message
    codyaq2 greentooth
    We have huge issues with using alpha in textures and destroying the texture quality, it is even worse with some formats for android.
    We fixed this by never using RGBA unless it was an actual alpha blend texture.
    You could possible add the alpha/height in the normal maps blue channel and reconstruct the blue via shader.
  • RyanB
    Options
    Offline / Send Message
    I've found the problem is big areas of flat color.  Add noise and use "Best" compression.  I noticed a big difference when using best vs. normal compression on some lightmaps with flat white areas recently.
    http://blog.heyworks.com/making-the-quality-of-pvrtc-textures-higher/
  • echofourpapa
    Options
    Offline / Send Message
    echofourpapa polycounter lvl 4
    Cody, yeah, that's what I was going but then I got greedy and wanted to see if I could use that 4th channel.

    RyanB, that's really interesting.  I'm guessing it's just a way to try to counter act the compression artifacts?

    I wish I had a better example ready, but this will do:
     I have all my maps with out alpha: set is Diffuse Albedo(RGB), Specular Albedo (RGB), Gloss(R), AO(R), Normal(RGB)

    In the shader all I am doing it sampling the texture and using the RGB or just R and setting them to their correct output(Unity Standard Specular).
    For the normal map I'm just expanding the RGB value from 0 to 1 to -1 to 1(which is all Unity does for iOS anyway).

    This is a baseline: 



    If I change my Specular map to pack the gloss in the alpha I get these dots:




    Even if I don't read from the alpha channel, as long as the alpha channel there I still get the noisy dot pattern:


    And if I try to put anything in the alpha channel of the normal map the problem becomes much more pronounced:

    This is the same normal map, but switched from RGB to RGBA.  The Best compression options helps, but the distortion is still there:


    The effect is much more pronounced on steel/chrome metals.
  • codyaq2
    Options
    Offline / Send Message
    codyaq2 greentooth
    Couple of things, if you are using flat colours for your albedo, try use powers of 8, we found it compresses better:P

    Also, if your image is not flattened, it may contain alpha even if you don't think it is possibly? (when we scaled down our .pngs it had a alpha border, so we have to flatten that before we save out)
    (i just re-read your post, and what i mentioned second doesnt apply to you now :P)
  • mikiex
    Options
    Offline / Send Message
    mikiex polycounter lvl 5
    PVRTC is 2bit or 4bit per pixel, but both these data rates support alpha channel.

    Most people use 4bpp, if Alpha is not preset in a 4x4 pixel block all the bits go towards RGB.
    But if you use Alpha, it comes at the expense of the quality in other channels within that 4x4 block.
    In some cases adding noise can improve things, even the PVRTC tools will do this.

    You might be better off using a second compressed texture instead of using the alpha channel,
    Of course this means the added work of dealing with multiple textures and having to rewrite shader + slight performance implications.
    But you will get better results.

    Another plus side to doing this, is that on OpenGL ES 2.0 spec (if you are doing an Android port) the only mandatory compression format is ETC1 and this format doesn't support an alpha channel. Some engines (eg. Unity), will fall back to 16bit when faces a texture containing an alpha channel that is set to "compressed". 16bit is not great, its quite a bit of memory and will lead to banding in RGBA mode. Its still useful though especially if you use dithering (something Unity lacks in it's pipeline as standard).

    Also don't forget there are A8 type formats if you need an uncompressed 8bit single channel texture.

Sign In or Register to comment.