Search Unity

Question Comparing Channel Values

Discussion in 'Shader Graph' started by Studio-Raef, Aug 5, 2020.

  1. Studio-Raef

    Studio-Raef

    Joined:
    Jul 1, 2013
    Posts:
    9
    I'm having difficulties with handling values of channels in shader graph.
    I've got the feeling that for some reason the values I feed into custom functions aren't correct.
    It's as if they are compressed or boosted in brightness. I've set up a simple Example where I try
    to compare the value of the channel and when it it's lower than the given value, it should turn white, higher it should turn black. Best way to test this seemed a Gradient so I turned the gradient into a texture and fed the Red channel to my function that just compares its values with 0.5f but the result goes past the 50% mark of the 2D Image. The gradient seems fine, even generated gradients through photoshop provide the same result. What am I missing, do I need to pass the channel through a different node before providing it?

    The comparison function isn't what's needed for my shader (I know there are better ways), I just debugged and noticed this to be the core of my problem with custom functions.



    I'm probably overlooking something