3
$\begingroup$

Curve spinning

I can solve the spinning issue by constraining pivot axis to X or Y instead of auto, but I am not sure how to combine the two rotations (assuming that is what needs to be done). This might be a Euler to Quaternion conversion issue.

Here is what I am trying to achieve (but this only works rotating around x-axis and does not work for y or z axis rotation of course): enter image description here

Please see attached .blend file.

The curve needs to be able to rotate on all axis without the instances moving out of place.

Level 2 with the curve deformation (I am not sure this one can be solved):

$\endgroup$

2 Answers 2

4
+250
$\begingroup$

I'm really not sure you asked the right question.

This question has 2 parts.

1:

But here is an example that I think you need: enter image description here

enter link description here

As you can see, we have 2 vector: Curve Normal and Curve Tangent. Math side of this problem: Matrix. For build correct euler rotation vector, first have to build matrix. This not so correct, but it clear. Idea: Cross production of 2 vector is other one, perpendicular vector. Now, is combine 3 parallel vector in one object, we have matrix. Matrix can be reinterpreted in to euler rotation vector.

  1. Right now you can skip matrix part in geometry nodes by using Align Euler to Vector. If imagine: this node create serphase, what normal is inputting vector. Theoretically, now you can get random rotation from this surface. But this no make sense. We can get only one random rotation to point on this surface.
  2. Now another one Align Euler to Vector rotate previous euler rotation (attached to new surface) for align to new normal what is Curve Normal. This step finalize mathix by 2 vector, but virtually, we work only with surfaces, normals and rotations. But as result, we get full rotation matrix, builded in euler rotation vector.
  3. Last one step. Random rotation, if convert it to rotation matrix, we can multiply it on other matrix, that can be other rotation matrix is. You can avoid matrix on this step by Rotate Euler node.

If write this as math formular:

Curve Basis = {Curve Normal, Curve Normal * Curve Tangent, Curve Tangetn};
Other Matrix (Rangeom intances rotation euler vector) -> to matrix;

New one = Curve Basis * Other Matrix;

Rotation = New one -> as euler;

Not yet:

  1. Patrionally this task will be solved, if Jacques Lucke (Geometry Node dev) will add Axis to Euler node (that just combine first two steps).

enter image description here

  1. Or if Lukas Toenne finished nodes-matrix-types branch

2:

The rotation of the curve implies a complete change in its position. Unlike default attributes, normal and tangent are parametric. And the calculation happens at the moment you need the attribute.

That is, if you rotate your geometry, the parametric attributes will be calculated according to the new state. This means that the parametric normal will be calculated differently. And under certain conditions, it will look like excessive rotation.

Since you are not deforming the curve, but transforming it (by multiplying by the matrix in theory), then in order to be able to capture the normal before the transformation, during the transformation, the normal must also be rotated (multiplied by the matrix of the new space). Just like any other vector. But the parametric normal is the only thing that changes in this case.

Fixed your example file


At last, will be more simple, if instansing all elements at first, and after this just use Transform Geometry (or make it to be another instane and transfome this)

$\endgroup$
5
  • $\begingroup$ Thank you for trying to answer this question, but above does not appear to work. Please see the .blend in the question. I want to rotate the curve and the instances to move with the curve without spinning out of place (I will attach a gif of the desired effect). I believe this is happening due to Euler limitation when converting to Quaternion matrix. $\endgroup$
    – VSB
    Feb 6 at 3:37
  • $\begingroup$ I was add another one point directly for your case $\endgroup$
    – mod nop
    Feb 6 at 22:04
  • $\begingroup$ You are pretty close with the last edit, but it breaks with non-zero rotation point. I moved the host curve using Set Position node and changed your file to sample the position of the first index to use as the center of rotation for the "Rotate" groups. When rotating it began to behave similar to the issue I had. $\endgroup$
    – VSB
    Feb 6 at 22:26
  • 1
    $\begingroup$ Make sure, you haven't rotate normal around some non-zoro centre $\endgroup$
    – mod nop
    Feb 6 at 22:28
  • $\begingroup$ That solved it!!! Thank you! $\endgroup$
    – VSB
    Feb 6 at 22:30
3
$\begingroup$

If you want the tangent to stay consistent to the rotation given to the spiral curve, just add a vector input (for the rotation) and plug it to the Align Euler to Vector.

Doing that, the relative relation between the spiral rotation and its tangents should be constant, and there is no more spinning effect for the instances.

enter image description here

Complement: why the instances are spinning without that?

As the Rotation input of Align Euler to Vector was not given Blender considers it as $(0, 0, 0)$ rotation.
When the parameter is "auto", the documentation says:

Auto

The best rotation angle is computed automatically. 
This minimizes the angle of rotation.

And to minimize the angle considering the tangent and the constant $(0, 0, 0)$, this is not always the same result, and that explains the spinning of the instances.

Giving the same rotation for both the spiral points and the Align Euler to Vector, this calculation stays stable, as the tangents are rotated the same way the spiral itself is.

$\endgroup$
19
  • $\begingroup$ Maybe I don't understand the question, nor your answer, but if you don't plug in a node at the Rotation input, the values $(0,0,0)$ are automatically used. $\endgroup$
    – quellenform
    Feb 7 at 9:08
  • $\begingroup$ @quellenform, yes this is the point... I'll add some explanation about that... my understanding of the question "when the spiral is rotated, the instances are spinning around the spiral and this is unwanted", right? $\endgroup$
    – lemon
    Feb 7 at 9:10
  • $\begingroup$ Ah, now I understand: you mean that the desired rotation should be entered here. ...I have misunderstood. This would actually stabilize the rotation, because the same rotation applies to both the base object and the instances created there. Correct! $\endgroup$
    – quellenform
    Feb 7 at 10:12
  • 1
    $\begingroup$ @MarkusvonBroady, yes, but this is similar to Robin's answer (deleted): have a look at the comments below it. $\endgroup$
    – lemon
    Feb 7 at 10:36
  • 1
    $\begingroup$ @lemon this answers the question as it is written as well! Bonus points if you can make it work without knowing the rotation of the host curve. In my actual application the host curve is a Realized Instance on a highly deformed curve. I was trying to keep the question simple.. $\endgroup$
    – VSB
    Feb 7 at 14:34

You must log in to answer this question.

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