A bit of a discussion about quaternion rotations started on this thread, but it was off-topic. For those who are interested, let’s continue it here.

Here’s the basics of quaternion rotations (may not be entirely clear, and it glosses over some stuff). Don’t be frightened by the length. It’s actually pretty simple. A proper explanation would involve much less talking, and a couple visual aids. But lacking visual aids, I have to do more talking. So here we go:

There are many ways to think of quaternion rotations, but I think the most useful for animators is to think of them as being sort of like shape keys. The W, X, Y, and Z curves represent weights. But instead of being weights for shapes, they’re weights for orientations.

W is the weight of the non-rotated (default) orientation.
X is the weight of the orientation you get when you rotate 180 degrees around the X axis.
Y is the weight of 180 around the Y axis.
Z is the weight of 180 around the Z axis.

You can play in the IPO editor to see how this works. I recommend making a bone, and parenting a monkey head to it so you can see the orientation more clearly (the bone on its own is fairly visually ambiguous when it comes to rotation). Then set a keyframe for the rotation of the bone, and play with the WXYZ values in the IPO editor.

If you set W to 1, and the rest to zero, it’s at the W position. If you set X to 1, and the rest to zero, it’s at the X position. etc.

You can also mix the orientations together. What’s important when mixing is the ratio between the weights, not their exact values. So having both W and X at 0.5 is the same as W and X both at 0.2 or 1000. In short, the weights get normalized.

If you have a mixed set of weights, and you increase or decrease just W’s weight, the object will rotate directly towards or away from W. The same goes for X, Y, and Z. It always rotates along the most direct axis of rotation. This also holds true for evenly blending between any two orientations, even if it involves all of W, X, Y, and Z. It always rotates along the most direct axis.

That’s quaternion rotations in a nutshell. It may seem a bit complex at first, but just play with it for a bit and you’ll see how simple it is. The curves actually do make sense.

I left some stuff out of this (like what negative weights mean, for example), but I’ll cover those things in the video tutorial, whenever I get it done (don’t hold your breath). Until then, feel free to play and figure it out for yourself.

The most important thing to remember is that (like I said before) the weights work based on ratios. Here’s the reason: an object can’t be 100% W and 100% X at the same time, so if both W and X are at 1.0, it has to normalize them. This is also why, for example, increasing X’s weight even beyond 1.0 won’t ever quite reach X if W still has some weight. You’d have to reduce W’s weight to zero first.

I hope this late-night tired explanation makes some sense. This really is the core of understanding quaternion rotations. It’s just blending between four base orientations. If you get this, you’re basically set. The rest is (mostly) detail and helpful hints.

Cool, that makes total sense … thanks Cessen!

Yep, great explanation, I have actually been wondering about this in the last couple of days. It makes sense now, I have a question related to this. If I want to make a bone within the armature spin (rotate, say 3600 degrees, local z axis, for example, the wrist of a robot - how can I do this? I understand now why it does not work using IPO editor with quaternions, but those are the only rotation options I get when making a ‘pose’ curve in IPO for a bone.

Very intuitive. Now I can ‘see’ Quat rotations finally. Thanks.

EDIT: As Cessen points out, the explanation of quaternion rotation in the video I linked to is wrong … so, check it out to get a good idea how euler rotations work, but ignore the bit about quats.

Original post:
For any who haven’t seen it yet, there’s a video explaining rotations over at Guerrilla CG … it focuses on Euler, but briefly goes into Quaternion (at about 4:30). It doesn’t deal with animation curves, but does help to visualize the differences between the two systems.

It’s explanation of quaternion rotations is also very incorrect. I advise strongly against referencing the quaternion part of that video, because the information presented is false.

However, its explanation of euler rotations is absolutely spot-on, and very well explained. In fact, it’s one of the best video tutorials on eulers I’ve seen. I definitely recommend the video for learning more about how euler rotations work. Just not quats.

Ah yes, reading the comments on the video shows that others have pointed out the errors to the presenter … maybe he’ll update the tutorial at some point. I’ll update my post, so as not to confuse anyone reading this thread.

I was a bit confused too, watching the video again after reading your explanation. I just assumed it was a different way of explaining the same thing.

Thanks lots for the explanation, I think I understand quats a lot better now!

That’s a very useful and concise explanation that I’ve never come across before. Quats seem so simple now, thanks a lot.

Other explanations I’ve come across get really bogged down in 4 dimensional imaginary numbers with 3 imaginary axes and 1 real axis :spin: (x, y and z are the imaginary ones, I presume…).

For anyone interested in a very obscure application of quats (actually quaternion pairs or floretions… just to really boggle your mind), check out the script by Oozecandy in this thread.

I also found an application of quaternions to 3d fractal imagery. There are some really nice videos out there if you fancy searching for them. Try googling “quaternion 3d fractal video” or something.

Really looking forward to the video tutorial if you ever get round to it, Cessen. :eyebrowlift:

Ok, but how do you use the curve editor to define rotations ease in’s and ease outs when you have “mixed rotations”. That’s the confusing part to me. I am still stuck in Euler as maya uses that and it’s what I’ve been taught in AnimationMentor.

Yes, that is the first accurate explanation I ever ran across. You can think of three of the numbers as representing an axis of rotation, and the remaining number as representing the angle of rotation around that axis (actually, the cosine of half the angle). It doesn’t actually matter which ones you choose to be the axis, though you do have to shuffle things around in space a bit to make it work out. But regardless of which components you choose to be the axis, the final orientation always turns out the same. Kind of cool and freaky, I think.

Anyway, it’s also a useful way to think about it. Just not so useful when you’re trying to tweak the curves directly. And it’s also not very artist-friendly. But it does lead to some cool realizations. For example, if you keep W (or any of the components) at zero, the object’s orientation will always remain exactly 180 degrees away from that component’s orientation. No more, and no less. Exactly 180. Cool & freaky, eh?

But anyway, I think the mixing analogy is far more artist-friendly. The axis-angle analogy isn’t really that useful for animating with.

The same way you do with Eulers: tweak the ease-in-ease-out of the curves. There’s no magic behind it. You’re in no danger of making things totally freak out by making adjustments to the curves. Quaternions rotations are very stable, so don’t worry. Small changes to the curves will result in small changes to the animation. So don’t be timid.

Just get in there and start tweaking! It’s actually not hard at all. Maybe I’ll post an example Blend later, just to get you started. But really, there isn’t much that’s different.

EDIT:
Here’s the example file: quat_curves_example.blend

There’s two main things to notice with the curves in this file:

1) It’s exactly the same as you would tweak eulers. Steep means fast, shallow means slow, sharp means sudden change in direction, smooth means continuous smooth motion, etc. There’s no magic here. There’s not even anything new you have to learn.

2) I’ve set keys roughly every 90 degrees of rotation. This is actually important, because a linear blend across 180 degrees of rotation won’t result in a constant-speed rotation. The reasons are a bit tricky, but also not important. Just make sure to set keys roughly every 90 degrees for larger rotations. It doesn’t have to be exactly 90, just roughly. This will keep things working the way you expect.

Hope this helps!

I find there is a lot of “intuition” from Euler that does not translate to Quaternion. For example if one starts with all quat curves near zero and start expanding then slowly, the result will not be any expected sort of ease-in because of the normalization happening with the very small values. The normalization will generally do some tweaking behind the scene so to speak unless one keeps the IPO points normalized with the help of a calculator or a spreadsheet.

While this is true, I’m not sure why that’s unintuitive within the weighting analogy.

It’s also not something you’re actually going to run into. You’d have to purposefully set all the components to be near zero. And if the user is thinking in terms of mixing with weights, they’re never going to do that: it makes intuitive sense that at least one of the components needs to be non-zero. And it’s certainly not going to happen with setting keyframes in the 3d view, because there’s no orientation where all the normalized values are near zero.

…And i am a dummy… cause i try to tweak with the Limit Rotation Constraint on bones… and it seems to actually make absolutely no change… ;…(
I read and read your explaination and other and the book… but i still don’t understand what to do… exept making all my animation visualy… :…( …(again)

This sounds off-topic to me. The Limit Rotation constraint is specified in eulers, not quaternions. If you’re having trouble with any of the constraints, please start another thread to ask for help.

Sorry!
Juste because ypoissant mentionned an issue with Quaternions…
Oooops!..