I need to plug a value output to the position of the black slider in the ColorRamp b-spline.
Is there a way to do that with drivers or do I have to create the b-spline from scratch, and if so, how?
This may be of help.
Thanks for your time, although that the opposite of what I’m looking for.
He copied a driver from the input of the color node, I’m trying to copy a driver from the output.
(I want the position in the colorramp to be the output of the multiply node, which is not a constant value, it’s the distance from the y axis)
You’ll need to create your own ramp function…
The B-Spline in the RampNode has its step values harcoded in a way they are sent to the render engine as static variables.
If you want them to be dynamic, you need recreate them either by replicating that function with nodes or with OSL.
Most relevant math can be found here, and the OSL code for the ramp node is here.
I’ve found that on Wikipedia, but for two points(white(0,1) and black(1,0)) the function returns only 1 and 0. Do you know why?
(by the way, the x value of the black is the one I’m trying to control)
Hi there!
It may not be suitable for you, but the Map Range Smoother Step is kinda B-Sline-y and of course, you can plug values in there, to animate it for example…
https://docs.blender.org/manual/en/latest/render/shader_nodes/converter/map_range.html
Although Wikipedia information is correct, understanding what it says is sometimes far away from its meaning… I could explain you with all my metaphors and examples how to correctly interpret that sample you took, but instead here’s a (very) nicely made video from Freya Holmér that will do a far better job in this clarification.
Aside from that, you’ll just need to find your best mapping from a color space to your spline space (and/or vice versa).
spoiler: in the Color Ramp node, the t value maps to the Fac
socket (from 0 to 1), and all the spline’s Pn are the steps in the ColorRamp.
Thanks!
If I understand correctly,
the Fac is t, the white is P1=(1,1), the black is P2=(0,0), the pos slider is the x value of P0 and P1 and the color is the y value, but where are P0 and P3?
In theory, when you have just 2 points, the result should be a linear interpolation (and with 3 points, a bezier)…
But Blender does something a bit different when you chose the B-Spline, and it extends the color ramp in both directions, “adding” a point before the first step and after the last one. here’s where this happens (~ln 476-507)`.
One last thing, the output is a 2D vector, how do I turn it to a value?
Well… I’ve noticed that you mention Px=(a, b)
… I didn’t said nothing because you’d probably figure that out sooner…
The whole calculation involves only Vectors of N dimentions and scalars (with N being a constant for all vectors)… if your output is a Vector2 , it can only mean that you’re using Vector2 as input.
A color is at least a Vector3, for each color component RBG; or a Vector4 if you use Alpha… If your Points are colors (either RGB or RGBA) then the output should be a color.
But for each P there’s the value of black/white and the value of the pos slider.
(I’m ignoring the z axis)
Edit:
Are the Ps only black/white values and the pos sliders in the color ramp translate to a map range that affects the t value before or after the b-spline manipulation?
I think you’re missing the main concept…
And note that although he video uses mostly points as an example, we can use whatever we want to interpolate. In this case, Colors (and P0, P1, P2, P3 are/should be colors!).
What you tried to do in that nodegroup is for one segment… A colorRamp is made of 1 or more segments, and the Fac value is mapped to be in the range [0, 1] for every segment.
The video I posted talks about this in chapter 2 (starting at 9:37).
So there are 3 b-spline curves, one from the left of the colorramp to the black, one from the black to the white, and the last from the white to the right of the colorramp.
I understand the why, but not completely the how. what should the values in the third curve be?
(all the drivers are the pos of the white in the b-spline colorramp)
It’s hard to see what you’re doing there…
Pluging the wrong types together brings an extra complexity to what should come out (colors are different than vectors when you convert them to values, concecutive calls with wrong mappings is a ****)…
Can you elucidate us better what is really your goal?
I’m trying to use the distance from the z axis(multiplied and powered) as the pos of the white