Scene Color Node in 2D renderer (URP) in ShaderGraph doesn't work--any workaround?

The Scene Color Node does not work because it uses the _CameraOpaqueTexture. Since the 2D Renderer does not generate an opaque texture - and transparent sprites do not write to that texture - it’s not going to work.

You probably want to use the _CameraSortingLayerTexture. You can find a demo of it here:

In Shader Graph declare a new Texture2D property, make sure its reference is _CameraSortingLayerTexture, and UNCHECK Exposed. This tells ShaderGraph to get the global texture by that name.

Set up your 2D Renderer Data asset to generate the _CameraSortingLayerTexture.

The sprite that makes use of that Shader Graph must be set to render AFTER the _CameraSortingLayerTexture is created (set it to a later Sorting Layer) or else you’ll get the last frame’s colors which will look very odd.

6 Likes