5
$\begingroup$

Blender 3.0 . I wanted to be able to change a the color and position of the sliders in the Color Ramp node via another set of nodes, but there's no input for the "slidering gradient thing". There's just fac input. Is there a way to do this?

I don't need a complex setup, just two of those sliders work( two color inputs and two position inputs. I guess that counts as simple!). In my project, the number of these sliders are not meant to be changed; so if it's possible, please give an comprehensible answer for a beginner like me. Thank you

$\endgroup$
2
  • 1
    $\begingroup$ There is no way to change those sliders from an input to the Color Ramp node. You can only do it by hand or by writing a Python script. $\endgroup$ Commented Dec 25, 2021 at 16:40
  • $\begingroup$ Similar question, you could recreate the color ramp node with math nodes: blender.stackexchange.com/questions/40120/… $\endgroup$
    – bstnhnsl
    Commented May 25, 2022 at 7:48

2 Answers 2

11
$\begingroup$

If it's only two colors and two sliders you want, you can recreate the Color Ramp with a Map Range node and a Mix RGB node.

Set the From Minimum value to the position of the left slider and the From Maximum value to the position of the right slider. Leave To Min and To Max at 0 and 1. Plug the result into the Fac input of the Mix RGB node and set the first color to the left slider's color and the second to the right slider's color.

In this example the left slider is red at 0.25 and the right one is yellow at 0.45, the left sphere uses the Color Ramp material, the right sphere the Map Range material:

map range color mix

I'm sure you could build even more complex setups to recreate more than two sliders and maybe even different interpolation modes (since Map Range also has more than just Linear).

Speaking of interpolation modes, if you want to keep the options of interpolation from the Color Ramp like Linear, Ease, B-Spline, Constant, you can still use the ramp but "expand" it a little bit.

You take a Color Ramp with black and white and plug it into the Fac input of a Mix RGB node. Then you add two Value nodes in the material, you don't have to connect them to anything. Just right-click one of the values and choose Copy as New Driver. Place your mouse over the position value of one slider, right-click and choose Paste Driver. Now repeat that for the second Value node and the other slider.

color ramp drivers

$\endgroup$
2
$\begingroup$

And if you need more than 2 Colors you can use even more MapRange-Nodes just like this: enter image description here

$\endgroup$

You must log in to answer this question.

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