Search Unity

Question One Minus Node not working as expected

Discussion in 'Shader Graph' started by sreen999, Jun 1, 2023.

  1. sreen999

    sreen999

    Joined:
    Nov 24, 2020
    Posts:
    5
    Hello! I am working on a very simple shader that creates a simple gradient based on the UVs to have a concentration of textures in the middle, with a soft fall-off. I want to invert what I currently have and I thought this would work with the One Minus node. It doesn't inver the node as expected, which makes me think I might be missing something.
    upload_2023-6-1_14-32-53.png

    The Panner property slides the gradient from left to right, while the bulge width changes how big the gradient in the middle is. They are both floats.

    Currently, there are no texture nodes attached to it, so it's not due to sRGB which I had seen some people mention in regards to the One Minus node. Any help would be much appreciated!
     
  2. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,314
    UV returns [0 .. 1], you subtract some value, probably 0.5, the result is gradient [-0.5 .. 0.5], then you multiply by some number, and make it squared to end up with [0.25 .. 0 .. 0.25].
    After one minus node (1 - x) you should have [0.75 .. 1 .. 0.75] and it looks correct, although the picture is quite small, so I am not 100% sure.
     
    DevDunk likes this.