Search Unity

Question Gradient sample appears to not be linear?

Discussion in 'Shader Graph' started by RichardAtFive, Jun 3, 2021.

  1. RichardAtFive

    RichardAtFive

    Joined:
    Jun 6, 2019
    Posts:
    6
    So I'm just trying to use a gradient to control the opacity of a blend, but it's not looking smooth, and while I'm trying to debug this I've run into this thing that looks wrong, but I don't know if I'm just barking up the wrong tree.

    Despite my gradient looking smooth, in the final effect the opacity has a very visible switch from invisible to visible.

    I'm using the green channel from UV0 as the Time input for a Sample Gradient node, which seems to be the recommended way to get a linear sample. But the output doesn't look right.

    In the image I've photoshopped the gradient from the Gradient node down and rotated it to compare it to the preview in the Gradient Sample node. I'd expect it to look (broadly) the same. But there's a noticeable difference in how quickly the gradient is fading from dark to light.

    Is this something simple like "oh you've just forgotten to check this box"? Because I feel like I can't actually use a gradient the way I want to, if it's going to be messed up before I even get to use it. Thanks!
     

    Attached Files: