13
$\begingroup$

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

$\endgroup$
1
  • $\begingroup$ Due to the nature of node attributes that are not in or out sockets, I don't think this is possible without a python driver. $\endgroup$ Commented Mar 18, 2020 at 16:35

2 Answers 2

21
$\begingroup$

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

$\endgroup$
4
  • 2
    $\begingroup$ looks great! I'll try it $\endgroup$
    – snipers500
    Commented Mar 18, 2020 at 18:41
  • 2
    $\begingroup$ works perfectly, thank you so much $\endgroup$
    – snipers500
    Commented Mar 18, 2020 at 19:01
  • 3
    $\begingroup$ Note that you can right click in the node group field > "Copy as new driver" then right click in the color ramp field > "Paste driver" to save a few steps $\endgroup$
    – Gorgious
    Commented Mar 18, 2020 at 20:55
  • $\begingroup$ Thank you SO much! $\endgroup$
    – 3pointedit
    Commented May 21, 2021 at 5:12
1
$\begingroup$

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

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .