Search Unity

Question Blend sprite with scene color

Discussion in 'Shader Graph' started by Meatb0y, May 6, 2022.

  1. Meatb0y

    Meatb0y

    Joined:
    Jan 25, 2015
    Posts:
    43
    Hi ! I was wondering if there is a way in shader graph to blend a sprite with anything that is behind it, just like it work for particles shader or as in photoshop when the layer blend mode is changed ?

    I tried to blend my sprite with the node scene color but it doesn't work like i hoped :)
    Thanx !
     
  2. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,511
    Scene Color won't work with sprites in a transparency filled scene b/c this node uses the Camera Opaque Texture.

    The closest thing is in the the 2D Renderer, which can be set up to use _CameraSortingLayerTexture. It's not quite the same as SceneColor but similar.
    https://github.com/Unity-Technologies/2d-renderer-samples/tree/21.2

    Look for the Heat Haze Overlay scene. It essentially lets you take a snapshot of the current state of the transparent scene at a particular point. However, it's fairly limited.

    Dev discusses setup here: https://forum.unity.com/threads/uni...owcase-2021-not-working.1086896/#post-7017055 (note this post is a little old so the github is probably more accurate if something seems off). See also: https://github.com/gamedevserj/Shader-Graph-Experiments/issues/1