Search Unity

Question Custom Gradient

Discussion in 'Shader Graph' started by Athomield3D, Mar 27, 2020.

  1. Athomield3D

    Athomield3D

    Joined:
    Aug 29, 2012
    Posts:
    193
    Hi I'm trying to achieve a gradient color based on the position in object space Y coordinate with customizable inputs. It was not very hard (ie Color1*x+Color2*(1-x) ) but now I'm trying to shift the center of the gradient like in the image 3 along the Y axis. I tried remapping but didn't work.
    Shader :



    Result:

    Image 3 :
     
  2. alexandral_unity

    alexandral_unity

    Unity Technologies

    Joined:
    Jun 18, 2018
    Posts:
    163
    Right after the split of Object position you have an Add node with a default value of 0,5. Changing that 0.5 value should offset the center of your gradient like you expect, so just connect a vector property there.
     
    Athomield3D likes this.
  3. Athomield3D

    Athomield3D

    Joined:
    Aug 29, 2012
    Posts:
    193
    Ah right, works thanks a lot!