3
$\begingroup$

I am trying to make some shapes out of object coordinate vectors. I want to take a linear gradient (the X, Y, or Z) and bend it an arbitrary amount around an arbitrary point without distorting it. Currently, I am attempting this with Vector Rotate, as it lets me control the Angle and point to bend around. Here are the results with a 90 deg rotation:

enter image description here

And the nodes: enter image description here

The Rotation is being masked based on the vertical axis. I've put it through Steps to make it easier to see the width.

The problem is that this is getting distorted. The thickness of the gradient is being lost when it is bent. I would like to prevent this from happening accidentally, but would also like to be able to make it happen intentionally.

My current setup seems convoluted, and it feels like there must be a better way to do all this?

$\endgroup$
4
$\begingroup$

'Mix' is bad for this kind of thing - since it's a linear blend between two points (ie, a straight line) and so it will always distort for curved paths. In your case you need to rotate around the centre point and this can be achieved as follows :

material and example

Here the Arctan2 determines the angle to the mid-point and the Cosine/Sine uses this to effectively blend between the X and Y offset as a rotation based on that angle (so when the angle is close to one axis it's one offset and when close to theother it's the other offset). The Maximum and Minimum limit the rotation (otherwise it would produce a complete circle). The 'Snap' at the end is it to give the banding.

Animating the Maximum and Minimum produce the following :

animated result

$\endgroup$
3
  • 1
    $\begingroup$ Crikes! x sin(t) + y cos(t) = r ! Why isn't that one on the 'obvious' shelf? Maybe it is, for you... :) $\endgroup$ Sep 4 at 19:22
  • $\begingroup$ TBH, I'm not really sure how I pieced together this solution - I think it was more "instinctive" than anything! :-D $\endgroup$ Sep 5 at 21:56
  • $\begingroup$ For stuff to be 'instinctive' to me, I have to be able to visualise it. I can do this one algebraically.. but I still can't see it. :( It may click eventually.. $\endgroup$ Sep 6 at 7:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.