Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Shader Graph Blend accurate colors

Discussion in 'Shaders' started by GamedevFred, May 3, 2018.

  1. GamedevFred

    GamedevFred

    Joined:
    May 3, 2017
    Posts:
    4
    Hi,

    I was wondering if there is a way to accurately use an image alpha texture to blend 2 color values together in the shader graph.
    The closest I got was using "PinLight" mode in the blend node. But as you can see the output color value is not accurate.
    shgr_blend.jpg
    Or am I going about this the wrong way?

    Thanks for the help,
    Fred
     
  2. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    635
    What you want is basically a lerp operation : upload_2018-5-4_14-30-7.png
     
    Last edited: Sep 17, 2019
  3. GamedevFred

    GamedevFred

    Joined:
    May 3, 2017
    Posts:
    4
    Great, this is perfect!

    Thanks!
     
  4. dr4

    dr4

    Joined:
    Jan 14, 2015
    Posts:
    106
    thank you so much, this have been driving me crazy for days, I don't understand why blend don't do what Lerp does though (that is 100% what I would expect)
     
  5. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,238
    The Blend node has several different modes, which are designed to match those same blend modes from Photoshop. The default layer blend mode in Photoshop is the “Normal” blend mode. Normal as in “typical” or “expected” rather than “surface facing”, the later being the definition used in most places that word shows up in Unity. Photoshop’s “Normal” blend mode is a linear interpolation, aka “lerp”.

    Unity’s Blend node can also do a lerp by select its Overwrite mode.
     
    dr4 likes this.
  6. dr4

    dr4

    Joined:
    Jan 14, 2015
    Posts:
    106
    thanks for the explanation @bgolus , you are right, it looks like I was missing the sprite opacity to the blend node ( I assumed that 1 would be enough) but I did assigned it when I tried with lerp so it worked, if I do blend with assigned opacity it works as well
     
  7. malcomjarr

    malcomjarr

    Joined:
    Nov 18, 2020
    Posts:
    7
    When you want to mix colors on the canvas you need to use a low flow, and anything the layer modes can do can be created without the layer modes. There is also brush modes that has more than what the layer modes, like Color brush mode is very useful to change the color after something is painted. It will fill in transparent areas, and not something you would want to do. If you mix colors on the canvas, then there are more primary colors you might need to add. Primary colors go like this Red, Yellow, Green, and Blue. You can not skip over green to mix blue and yellow, because traditionally that would make green and primary color are colors you can't mix. You can't mix and get green. If your flow is kind of high, the paint wants to replace the color, and not mix with it. With a low flow you van mix color, but they will be influenced with anything under the colors unless the base color is filled 100%, then you can use a low flow to add color to it for a mix. Like skin color, and redness of the skin, like a sore spot, or light passing though an ear, showing the blood in the ear as if glows. If you'd like to blend two colors together in general, in a more paint like manner, I recommend experimenting with the mixer brush available in newer versions of Photoshop.