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

Overlaying nodes in shader graph

Discussion in 'Shaders' started by Nicksaccount, Jun 27, 2018.

  1. Nicksaccount

    Nicksaccount

    Joined:
    Jan 10, 2013
    Posts:
    24
    Does anyone know of a way to overlay nodes in shader graph without losing colours?

    If I have the following:
    Untitled-5.png

    I'd like to get the end result:

    Untitled-6.png

    I've tried nodes like "Add" (loses the colours as they get added) and "Blend" (doesn't seem to be a filter that does this) to no avail. What I'd like is one that allows me to overlay one over the other and ignore any pure black (or give me a threshold option)

    Thanks!
     
    TinyTeaOW likes this.
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,238
    I'm assuming the nodes just to the left are greyscale masks and individual color values. Funny enough the solution is nearly the same as your other thread. Use a Lerp (or rather a few of them).

    Use the red as is, then use a lerp node to blend from the red (A) to a green color (B) using the greyscale value as the mask (T). Then again to purple.
     
    TinyTeaOW likes this.
  3. Nicksaccount

    Nicksaccount

    Joined:
    Jan 10, 2013
    Posts:
    24
    That's great, thanks! I didn't quite get how to lerp in the other thread.

    I've left my finished graph below for anyone else that wants to see:

    Untitled-2.png
     
    TinyTeaOW and WendelinReich like this.
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,238
    Use Smoothstep instead of Step.
     
    TinyTeaOW likes this.
  5. Nicksaccount

    Nicksaccount

    Joined:
    Jan 10, 2013
    Posts:
    24
    Ah, that works great - thanks!

    Untitled-1.png
     
    TinyTeaOW likes this.