1
$\begingroup$

I have a setup where the rotation of my instances follows the curve tangent, but the Z axis of the instances points “away” from the direction of the curve where the angle of the curve is sharp enough.

What I’d really like is for the change in rotation from instance to instance to be smoother (most of this curve is what I want, but see a problem area circled in red).

curve with 3-sided cylinders instanced along it, and a sharp transition in rotations between several instances circled in red.

node setup that produces above curve

node group that calculates vector away from curve angle

To try to fix this, I’ve added some nodes that interpolate the “away from curve” vector in areas where the angle isn’t sharp. This helps in some areas but only pushes the problem around in others.

I have tried using a repeat zone to modify the rotation of each instance based on the preceding one (ie, X rotation of point n could be up to ±5° from point n-1) but this was very slow and didn’t quite achieve what I wanted.

I have also looked at using a blur attribute node to smooth the X rotation around the curve, which as you can see fixes some problem areas but creates others. As far as I can tell, the problem here is that the Y and Z rotations contribute to the object being flipped by 180° in some areas because they are flipped even if the X rotation is 0, but I am not sure how to account for that.

screenshot of the same curve, showing the rotation of the instances when the X rotation is blurred, which smooths out the previous sharp transition but creates a messy area elsewhere.

I'm using blender 4.5.3 - any help would be appreciated!

edit: added .blend file here

$\endgroup$
2
  • $\begingroup$ You can't derive rotation from the tangent, it's not enough. Tangent only gives you what its name mean : the axis of the tangent. Try using curve tilt instead. $\endgroup$ Commented Nov 9 at 9:54
  • $\begingroup$ Thanks Lutzi! I only need the tangent node to align the X axes of my instances with the curve, and it seems to be doing that ok - the rotation of the instances around their X axes along the curve is defined by another node group I made that makes them point away from the curve angle, and that’s the part I want to smooth out. Is this where the curve tilt could be useful? I’ve not really used it before, but it looks like a float instead of a vector $\endgroup$ Commented Nov 9 at 10:57

1 Answer 1

0
$\begingroup$

The problem with:

  • Blurring rotations: euler rotations are not well behaved, follow a correct axis sequence, and their coordinate values are not intuitive, many things can go wrong separating roation coordinates and trying to work with them
  • Blurring angles: angles can suddenly jump from -180 to +180 (same angle) and break the continuous math you're expecting
  • Blurring vectors: adding vectors create different size vectors that will have different influences in next iterations. The dominant vectors will prevail and the small ones will have little effect

Solution: blur vectors, but after every blur, normalize the vectors, so the small ones do affect the result

Result

Nodes

  • Simplified curve direction: just take a cross product of tangents and you got the curve. But instead of Z, it will be used for Y.
  • Normalize + Blur iterations: here, instead of making one big blur, we do several normalize + blur iterations as explained before
    • You can experiment the number of iterations both in the repeat zone and in the blur nodes, but the blur alone will not work

Nodes

$\endgroup$
1
  • $\begingroup$ Thank you, this worked perfectly! I’m still too new for upvoting privileges but I’ll give you one as soon as I can $\endgroup$ Commented Nov 10 at 20:56

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.