Is there Blender analog for Adobe Illustrator freeform gradient?

I am wondering if it is possible to create a gradient with controllable number and positions of gradient central point. Something like freeform gradient in Adobe Illustrator.


I’m not familiar with Adobe Illustrator, and I don’t think there’s anything built into Blender like that. But if I understand the tool correctly, you can build it yourself out of nodes:

I’m mixing (in linear RGB) between three different colors based on the relative, normalized distance between three empties. You can add as many empties to this as you want (hopefully, it should be clear enough how to do that.) You can reposition the empties or change the colors associated with them. It should be possible to mix other ways, but there might be some pitfalls-- not sure how you’d handle a hue mix between three colors, two of which might be very very close but on opposite sides.

1 Like

Hi, thank you for the quick reply!
It indeed does what I asked for. But I would be very glad if you explain a bit more about vector math here (don’t have understanding yet). In particular, what does “length” give as an output? As an input it uses “Texture coordinate” -> “Object”, which uses coordinates of a point relative to the coordinate of the “Empty” object (if I understand correctly). Does it mean that after “Length”, instead of coordinates we have distances from the “Empty”? As in the top left image below?

Now I tried to understand the nodes you show (using only two Empties) and got confused - I don’t understand how you get relative normalized distance. To me it seems that you are normalizing to the reverse sum of the distances. Using your idea I would build the normalization a bit differently. I show it in the right top (your nodes) and right bottom (my nodes) images above (though the result looks almost the same). Please, correct me if I am misunderstanding something.

Even though the reply perfectly answers my original question, I realize that the question was incomplete. There are two things I would like to control. But maybe it is very complicated…

  1. I realized the problem with colors. If I have green, blue and red, their sum gives white. But with two colors that are not opposite on the color circle (red and blue, for example), I am getting blue+red=violet background everywhere away from the empties. What I want to have is some neutral transition color like white between red and blue.
    I can demonstrate it (was done in Illustrator) in the left bottom image above. On the bottom, the gradient goes from red to blue, whereas above, two gradients are separated by white. In Illustrator I achieved it by drawing a white-gradient-line around the red-gradient point, so it is not just simple gradient)

  2. Finally, I would like to control how quickly the gradient fades away from the center. In your nodes, the color changes as 1/distance, which seems very fast. Only at the empties the color is distinct. It would be better to have larger areas with dominant red and blue and small transition zone.

I know it is a lot of questions, I am exploring blender as I can, but here I am struggling and hope for some help.

Oh, I actually realized the normalization. That reverse normalization in your nodes equals b/(a+b) and a/(a+b). Somehow I did a stupid math mistake when I first checked it.

The length of the vector it’s handed. You know, (x^2+y^2+z^2)=l^2 for positive values of l.

That’s what it means, provided that the empty has regular old 1/1/1 scaling. (It’s actually distance from the empty, in the empty’s space.)

When the distance to an empty is 0, I want that empty’s weight to override all other empties. When the length is infinite, I want that empty’s length to lead to a 0 weight. Hence, I’m using 1/length. As length goes up, weight goes down. That’s primarily so that I can use named empties in order to more easily demonstrate what I’m doing. If you create a third empty with your node group, you’ll find that your “blue” empty doesn’t actually mean blue, it means, “not red.”

You can do it any way you want. There aren’t any rules. If it works the way you want, then it’s right.

Then add another empty and make its color white.

Then use different math than 1/distance. Try running distances through math/power nodes fed by a single value node. The weights get normalized at the end anyways, so doing a power operation will only change the curve.

But if you’d prefer, you can also do something to the normalized values, and then renormalize them afterwards. That would let you run them through three copies of an RGB curves node, which might be a more intuitive way for you to handle this.

It also occurs to me that this might not be exactly what you’re looking for, even though it ought to be good enough for most use cases. Consider a sample way over there, almost infinitely distant from both empties, but still on one side. The node group I showed is going to give that an even mix, when you’d probably prefer it to be fully the color of its side. The math for this is pretty simple for the two-color mix, but for any arbitrary number of colors, in 3D, I’m not convinced that it’s even a well-defined idea.

1 Like