Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How to invert the alpha channel of PNG? Substance Painter Opacity to Unity PBR Transparency workflow

Discussion in 'General Graphics' started by AlanMattano, Jun 2, 2021.

  1. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    I'm making transparent PBR material. My problem is that alpha (texture) is inverted.
    Painter and Unity are inverted.

    So in Adobe Substance Painter use "Opacity" for 0 black transparent to 1 white opac and not transparent.
    And in Unity 2019LTS PBR default shader the alpha transparency is inverted so
    1 is white and transparent.

    I did not find an option to invert the "Opacity" output in S. Painter:
    https://forum.substance3d.com/index.php?topic=37676.msg138873#msg138873
    In painter, there are a lot of layers that trigger my opacity so I'm not able or I do not know how to invert them properlly.

    If I open Photoshop, the PNG has no alpha channel and the transparency is applied to the three RGB channels. So is a bit complex inverting the alpha or I do not know how to do it. (And difficult to change all my textures output)

    What Is the workflow workaround?
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    An alpha of 1.0 is always opaque, 0.0 is always transparent. If there's a Unity shader that it doesn't work that way, it's a bug. Though I should note Unity 2019 doesn't itself come with a PBR shader. Are you referring one from the URP or HDRP?
     
    Last edited: Jun 3, 2021
  3. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    As a follow up, even though you really should not need to do this for this case, Photoshop's PNG handling is really terrible. It assumes you're using PNG files for web pages and nothing else. If you want better control over PNG files, you should download SuperPNG and use that instead. If you hold down shift while opening a PNG with the SuperPNG plugin you can choose to open it with the alpha as a separate channel rather than as layer transparency. As well as save PNGs without clearing the color in areas with full transparency which Photoshop does by default and can't be turned off.

    https://www.fnordware.com/superpng/
     
  4. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    So is not inverted

    Yes, Photoshop is terrible. I import the BMP instead to Photoshop and exported the PNG.

    SuperPNG fantastic and thanks for the instructions!

    I'm using the Unity 2019 default shader (the Unity 5 PBR?).

    You are right: An alpha of 1.0 is always opaque.
    Probably what is happening is that at 0.95 is no the same in Unity as is in Painter.

    I'm experimenting but was able to get it right
    022 SG38 Unity2019 .png
     
    Last edited: Jun 5, 2021