13

What are some practical uses for the Quaternion? Why not just use the Euler X, Y, and Z axis rotation values?

It's not intuitive how one should manipulate Quaternions. Can someone explain this?

Amir
  • 3,074
  • 2
  • 29
  • 55
Thom Blair III
  • 16,535
  • 20
  • 75
  • 112
  • I don't have much experience with it, but it helps avoid gimbal lock and is often used for animating rigs. – gandalf3 Mar 19 '14 at 03:02
  • There's actually a good video in the Humane Rigging series that was referenced in the IRC channel just now: https://www.youtube.com/watch?v=FRD0PgsY3pU . It talks about gimbal lock and interpolation. – Mutant Bob Apr 24 '14 at 19:17

1 Answers1

16

Quaternion has the advantage that it gives better interpolation between keyframes for arbitrary rotations, compared to euler or axis-angle, this is often used for character animation and why its default for armatures.

It also avoids the gimbal lock problem.

You make a good point that the f-curves are hard to control. Typically you wont manipulate each axis them directly, and instead pose the rig in the viewport.

So for walk cycles and arbitrary motion, quaternions are fine, Euler's are better if you want to control each axis and are animating something which inherently has separated axis you would want to apply in order (robotic joints for example - a gun turret where you might want to control 2 axis directly).


For more general info on this topic see:
https://stackoverflow.com/questions/8919086/why-are-quaternions-used-for-rotations

ideasman42
  • 47,387
  • 10
  • 141
  • 223
  • Ah hah! So, when you're moving something around multiple axes at once with a single movement! That makes sense -- that's exactly what the video I saw on YouTube was saying, that a quaternion describes rotation on multiple axes at once, so that makes perfect sense in the scenario you described of posing through the viewport. Thanks! – Thom Blair III Mar 19 '14 at 05:12
  • So, with that scenario in mind, can you think of any time you might want to change the quaternion value in the W data field, other than maybe to reset it to it's default value? – Thom Blair III Mar 19 '14 at 05:14
  • @ThomBlairIII - I cant think of any reasons to adjust the W, aside from the possibility of the axis switching from -1 to +1 between keyframes, but this isn't going to happen unless you already edit it manually or have imported f-curves. – ideasman42 Mar 19 '14 at 06:56
  • @ideasman42 Do you know if Quaternion performs better than Euler with Inverse Kinematics, or are they both equal? Just curious. – Mentalist Jan 25 '17 at 03:53
  • IK is applied after rotation is calculated (so no impact on IK output), This isn't spesific to IK, nearly all constraints operate on matrices. – ideasman42 Jan 25 '17 at 03:55
  • 2
    If any more recent reader is interested in how quaternions work, there is a superb new visualization here – Robin Betts Oct 28 '18 at 19:32
  • I watched that and now know that quaternion rotations are based on 4 dimensional hyperspheres, and my head hurts. Thanks a LOT. – stib Sep 17 '20 at 00:34