Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

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:
    155
    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:
    4,993
    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:
    155
    Thanks for such a clear explanation. :)
     
  4. VCC_Geek

    VCC_Geek

    Joined:
    Apr 30, 2013
    Posts:
    27
    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:
    155
    Thanks, I'll give that a shot :)