Search Unity

Strange RGBA 16 bit transparency issue

Discussion in 'iOS and tvOS' started by LeeHickey, Jul 9, 2009.

  1. LeeHickey

    LeeHickey

    Joined:
    Apr 8, 2009
    Posts:
    25
    We're very close the the completion of our game and are in the stage of tweaking some of the graphics. The game is a 2d sprite-based game and as such we don't want to use texture compression.

    The elements of the game are drawn in layers, all using a single alpha-blending shader. Our source textures are 32 bit TGA files, 8 bits per channel with alpha. Everything works fine if I use texture compression (the default PRVTC 4bits) or if I use RGBA32 uncompressed. However, if I use RGBA16, which I want to do to save half the memory, then my sprites appear to be *slightly* transparent, and I'm at a loss to explain why.

    I've confirmed that the source alpha is set up properly (set to 0 for all appropriate pixels) and I've tried using both normal alpha blending and premultiplied alpha blending so I can only assume that something is going wrong in the conversion to 16 bit which is resulting in a change to the alpha channel.

    Just for info, here is the shader I'm using:

    Code (csharp):
    1.  
    2. Shader "Unlit/AlphaBlend"
    3. {
    4.     Properties
    5.     {
    6.         _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
    7.     }
    8.  
    9.     SubShader
    10.     {
    11.         Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
    12.         Cull Back
    13.         ZWrite On
    14.         ZTest Always
    15.         Lighting Off
    16.         Pass
    17.         {
    18.             Blend SrcAlpha OneMinusSrcAlpha
    19.             SetTexture [_MainTex] {}
    20.         }
    21.     }
    22. }
     
  2. ugur

    ugur

    Joined:
    Jun 3, 2008
    Posts:
    692
    This is a known bug i reported before (rgba 16 textures showing as semi transparent) and it has been fixed so it will be gone for the next dot update release.
    Until then, well, sorry, but you have to wait or use rgba 32 or pvrtc meanwhile
    (yeah, i know..)
     
  3. LeeHickey

    LeeHickey

    Joined:
    Apr 8, 2009
    Posts:
    25
    Thanks for the info. PVRTC is not an option for us. I'll contact Unity and see how long the update may take.

    Thanks again.