Search Unity

shader graph blend node missing "normal" or "mix" mode

Discussion in 'Shaders' started by tripsan, May 10, 2018.

  1. tripsan

    tripsan

    Joined:
    Dec 26, 2013
    Posts:
    14
    am i correct in thinking that the blend node in the new shadergraph can not do a straight blend between two sources?
    just a direct mix or crossfade between two textures controlled by a float or opacity image.

    is this handled in a node that i have somehow missed?
    -j
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    That's the Lerp node. That's a function that's built into HLSL, so Unity likely chose to not duplicate it in the Blend node, though maybe they should since I suspect most people are going to get confused by this
     
  3. tripsan

    tripsan

    Joined:
    Dec 26, 2013
    Posts:
    14
    ah gotcha. yeah id wager that artists would find it more of a familiar interface.

    in fact because i found the blend node it sort of railroaded my thinking that this was an artists tool
    made for artists and it kept me from thinking about old fashioned lerping.

    thanks for the answer.
     
    Last edited: May 11, 2018
  4. Arlorean

    Arlorean

    Joined:
    Sep 7, 2014
    Posts:
    27
    It looks like the Unity Blend node with Mode = Overwrite is just the Lerp node. Here is the generated HLSL code:
    Code (csharp):
    1. void Unity_Blend_Overwrite_float4(float4 Base, float4 Blend, float Opacity, out float4 Out)
    2. {
    3.     Out = lerp(Base, Blend, Opacity);
    4. }
    5.  
    My artist has been walking me through why he prefers the Blender nodes and wondering why he has to relearn everything to create shaders in Unity. I'm trying to create him a Rosetta stone to make his life (and therefore my life) easier.
     
  5. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    Yes, they added that in the 3 years since this thread happened, likely because a lot of people couldn't find it.
     
    Arlorean likes this.