13

I have a ColorRamp node inside of a node group and I would like to have a group input which controls the "Pos" value of the white colour, but there doesn't seem to be a good way to do it. Since I'm only using two colours, is there a different way to do it?

color ramp node

snipers500
  • 469
  • 6
  • 16

2 Answers2

20

You can use drivers on the Pos value.
All you need is a driving value.

Let's make the drivers from the group input. First enter the group node, select the Group Input node. In the sidebar (open with N). In the Node tab, you can add Inputs, name them and set their default/minimum/maximum values. I added two new inputs: enter image description here

Get out of the node, right click one of the value inputs and hit Copy Data Path (here the White Posisiton):

enter image description here

Think of the Data Path is like the url of a website or the file path of a file on your computer, but here it's for any data on Blender.

Enter the group node, right click the Pos value corresponding to the data path you previously copied (here the white Pos) and hit Add Driver:

enter image description here

A pop-up will show to let you set your driver. Set it as I do:

enter image description here

  • Type: Sum Values
  • Icon next to "var": Single Property
  • Prop : Material → select your material
  • Path : paste the Data Path copied earlier
  • Hit the Update Dependencies button

Note that once your driver is done, you can edit it via right click → edit.
And you can also copy-paste it from one value to another.

So if you want to create one for the black handle: - right click the white Pos value → copy driver - select the black handle, right click the black Pos → paste driver - exit the node group and copy the Data path from Black Position - enter the node group, right click the black Pos → edit driver - paste the new data path - hit Update Dependencies

And here's the result:

enter image description here

L0Lock
  • 15,965
  • 1
  • 20
  • 44
1

I figured it out, I used two add nodes to do it, like this.

enter image description here

the first one sets subtracts 0.5 so it changes everything to be under 0, and the second one adds a number from 0-1, which is connected to the Group Input node

snipers500
  • 469
  • 6
  • 16