2
$\begingroup$

Conceptually I want what's in the picture. Rather than having the position / colour of the stop only being set in the node UI, can I plug another node in to control it?

enter image description here

$\endgroup$
4
  • 5
    $\begingroup$ Alas, no. The idea is discussed in the developer's lists from time to time, but nobody has ever come up with an acceptable proposal for how to do it. $\endgroup$ Commented Aug 9, 2021 at 2:44
  • 2
    $\begingroup$ instead of using colorramp you could use maprange node. This you can control by other nodes. $\endgroup$
    – Chris
    Commented Aug 9, 2021 at 7:04
  • $\begingroup$ @MartyFouts is that because there's no way of having a variable number of inputs in a node? $\endgroup$
    – stib
    Commented Aug 9, 2021 at 10:41
  • $\begingroup$ @stib Yes. There's no way to do that. The alternative would be to have a single input that works like a vector, like color values, but that can be variable length. But there's no way to do that either. $\endgroup$ Commented Dec 11, 2021 at 20:17

2 Answers 2

2
$\begingroup$

This question is a bit old, but this might be useful for someone. You can use input values and drivers to control color ramp node settings.

  1. Add an input->value node
  2. Right click on the number and choose copy as new driver
  3. Right click on the color ramp Pos and choose paste driver

You can do this for RGBA values but not HSV or HSL and the input value can come from wherever you want (almost) but certainly object custom properties.

If you want to do more than just patch a value in you can right click on the driven property and choose edit driver then change the type to scripted expression and add a formula in the expression. That way you can have one slider to alter all the stops on the color ramp.

However what you can't do is use the output of another node. To do that you have to set up something with maprange nodes

PS (edit) WRT the question in the comments. Rather than adding a value to the material as I have shown here, you can add it as a new value in Custom Properties in the Object Properties tab. You can then copy that as a new driver and paste it into the R, G or B slot of the Color Ramp node.

The material you create will always point to the same Object to pick up the Object Properties you have used i.e. you can't make a general material that can pick up values from whichever object you attach it to. HOWEVER there is a slight quirk in Blender that mean if you create a material on an object then Copy/Paste the object instead of duplicating it, it will create new materials with the .001, .002 etc suffix. These new materials will automatically get the references changed in drivers used in their materials.

enter image description here

$\endgroup$
2
  • $\begingroup$ How can you dynamically allow different values for different objects? $\endgroup$ Commented Jul 20 at 19:45
  • $\begingroup$ @ShammelLee added some more to my answer as a way to cope with different objects (still not ideal) $\endgroup$
    – paddyg
    Commented Aug 31 at 17:32
1
$\begingroup$

If you are using two color stops you can also just use map range node

from mix & from max values is positions of first and second color stops

to max & to min is the values of color stops

$\endgroup$

You must log in to answer this question.

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