Shader Graph - (How) does scene color work with 2D sprites?

Hello all,

I am currently trying to recreate the Photoshop Blend Modes in Unity. The whole thing should work with 2D sprites.
However, I don’t know how to blend the sprite with the scene. I think that the Scene Color Node is part of the solution, but it doesn’t seem to work.

This is the Blend Mode “Linear Dodge” in Photoshop (how it’s supposed to look):
8416482--1112958--upload_2022-9-5_14-16-50.png

Here is the same setup in Unity (wrong):
8416482--1112964--upload_2022-9-5_14-17-57.png

This is the shader I built so far:

Apparently Unity doesn’t blend with the background sprite in the scene, but with a solid colour. What am I doing wrong?

Scene setup:

8416482--1112976--upload_2022-9-5_14-20-17.png

8416482--1112982--upload_2022-9-5_14-20-50.png

Do you have a hint what could be the issue? Thank you!

Best,
Martin

Bump, as i also cant find a solution to this anywhere

SceneColor isn’t doing what you think it’s doing. SceneColor samples from the CameraOpaqueTexture
https://docs.unity3d.com/Packages/com.unity.shadergraph@6.9/manual/Scene-Color-Node.html

But 2D sprites are transparent, not opaque! There’s the problem. They’re not written into the CameraOpaqueTexture, so you can’t actually get the background color like that.

There’s a limited 2D Renderer workaround for this called the _CameraSortingLayerTexture. This lets you snapshot the colors of your scene at a particular point in time and use those colors in later effects.

1 Like