Search Unity

Bug 2021.3: Shadergraph do not support Sprite-Alphas anymore

Discussion in 'Editor & General Support' started by Jan_Hasse, May 9, 2022.

  1. Jan_Hasse

    Jan_Hasse

    Joined:
    Sep 11, 2017
    Posts:
    21
    Good morning :)
    I think i have found a unity bug with Shadergraph and 2D Sprites alpha.
    In 2020 it worked correctly. In URP 2021.2.x and 2021.3.2 the alphas are not working correctly and show different colors on the front and backface of a sprite (when used in a Canvas - bug shows only in game view). Sometimes its Black and Blue, sometimes orange and brown. The color varies every unity restart :eek:

    How to reproduce:

    1. Create Fresh Project URP 2021.3.2
    2. Create a Shadergraph: Create > Shadergraph > URP > Sprite Unlint Shadergraph
    3. Add Texture: Create a Sample Texture 2D Node, Insert a RGBA Sprite in Texture Slot.
    4. Create a Material: Create > Material
    5. Create a Canvas: UI > Canvas
    6. Create Image as Child of Canvas: UI > Image
    7. Insert the Material to Image Components Material Slot.
    8. Press Play
    9. View Bug in Game-View

    Here is the game-view front- and backside:
    Frontside.png Backside.png
    Svene View:
    Scene-View.png

    Shadergraph:
    Shadergraph.png

    like i said, it worked perfectly like this in 2020.3.X

    Can anyone confirm, that its a bug?

    Greetings, Jan
     
    Last edited: May 9, 2022
  2. RoHofmann

    RoHofmann

    Joined:
    Aug 15, 2017
    Posts:
    23
    Having the same issue. For me the colour seems to be the first colour that would have been picked if the alpha area was non-transparent.
    I'm using unity 2021.3.1f1, shader graph 12.1.6
     
    Jan_Hasse likes this.
  3. Yantao-Wu

    Yantao-Wu

    Joined:
    May 5, 2018
    Posts:
    1
    2022-05-21_21-32-12.png
    Me too. Unity2021.3.2
     
    Jan_Hasse and RoHofmann like this.
  4. RoHofmann

    RoHofmann

    Joined:
    Aug 15, 2017
    Posts:
    23
    Issue also exists in Unity 2022.1.4f1 upload_2022-6-13_11-18-16.png
     
  5. profanicus

    profanicus

    Joined:
    Nov 23, 2009
    Posts:
    295
    Same issue here in LTS 2021.3.20, shader graph 12.1.10. Is there any workaround other than downgrading to 2020? Would hand-coding the shader instead work?
     
  6. OxBEDDFACE

    OxBEDDFACE

    Joined:
    Nov 5, 2017
    Posts:
    2
    I'm seeing the same issue. Image looks fine in inspector but not in game view. Is there a solution? I have gotten a really dark brown and after restarting am not getting red. Is there a work around?

     
  7. profanicus

    profanicus

    Joined:
    Nov 23, 2009
    Posts:
    295
    I haven't found one, though I didn't keep looking for very long after my previous post. I just used HLSL instead, which worked fine.
     
  8. OxBEDDFACE

    OxBEDDFACE

    Joined:
    Nov 5, 2017
    Posts:
    2
  9. profanicus

    profanicus

    Joined:
    Nov 23, 2009
    Posts:
    295
    That is an interesting hack, thanks! But it doesn't really work for me, as it uses alpha clip rather than alpha blending (unless I missed something).

    Obviously alpha clip is fine for the bomb images you posted above, but not for ours. :)

    ShaderGraph with above technique on right:
    UnityUiShaderCompare.png

    I wouldn't rely on it for production as it seems to be a bug that Unity is looking into, since this shouldn't happen when switching the material modes.

    The thread is also interesting though in that they might actually add official support for the Canvas in ShaderGraph (one day)!