2021.3: Shadergraph do not support Sprite-Alphas anymore

Good morning :slight_smile:
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 :hushed:

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:

8112686--1050779--Backside.png
Svene View:

Shadergraph:

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

Can anyone confirm, that its a bug?

Greetings, Jan

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

1 Like


Me too. Unity2021.3.2

2 Likes

Issue also exists in Unity 2022.1.4f1 8200737--1069788--upload_2022-6-13_11-18-16.png

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?

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?

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.

This worked for me:
Unity ShaderGraph Issue Demonstration - YouTube

That is linked to near the very bottom of this thread covering the same issue:
Bug - Shader Graph UI Image Shader does not work - Unity Forum

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. :slight_smile:

ShaderGraph with above technique on right:
9134146--1268374--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)!