Search Unity

Alpha is not transparent

Discussion in 'General Graphics' started by Ben_Iyan, Oct 10, 2018.

  1. Ben_Iyan

    Ben_Iyan

    Joined:
    May 13, 2016
    Posts:
    173
    I have a strange problem that hopefully someone else has seen before. I imported a texture with an alpha channel into Unity (2017.4.12f). When I set Alpha is Transparent to true, the transparent areas become multicolored. The texture looks fine in paint.net, but not in Unity. Any ideas or suggestions? Thanks.
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    5,959
    The alpha of an image is just another data channel, like red, green, and blue. By default the alpha has no direct effect on the other color values. Also, any shader not set to be transparent is likely going to ignore the value in the alpha channel of the texture and just show the RGB values. When you check the "Alpha is Transparency" option on the texture, it doesn't change the behavior of the shaders, it's just telling the importer that any RGB value that is fully transparent won't be visible, so the importer modifies the texture to prevent possible fringing from mip mapping and bilinear filtering.

    Short version, if you want the alpha of your texture to be used to make something transparent, you'll need to use a shader that supports transparency.
     
    Ben_Iyan likes this.
  3. Ben_Iyan

    Ben_Iyan

    Joined:
    May 13, 2016
    Posts:
    173
    Thanks for such a clear explanation. :)
     
  4. VCC_Geek

    VCC_Geek

    Joined:
    Apr 30, 2013
    Posts:
    28
    If you're using the Standard shader, make sure to set the Rendering Mode (the drop list at the very top of the shader panel) to either Fade or Transparent. It's set to Opaque by default. In my experience, Fade tends to work better than Transparent; your mileage may vary.
     
  5. Ben_Iyan

    Ben_Iyan

    Joined:
    May 13, 2016
    Posts:
    173
    Thanks, I'll give that a shot :)