Phone: 905 409-1589
Email: info@penproductions.ca
RSS LinkedIn Twitter Twitter
Tutorials:
Quaternion Rotations and TCB Controllers:

 

Quaternion rotations are the way most 3D packages calculate rotations in 3D space. We saw in the Euler XYZ that it doesn't represent what a rotation really looks like in 3D space. Because of this quaternion rotations are used. A quaternion is calculated using four values instead of only three, X, Y, Z and angle. When printed out using Max script it will look like this, (quat 0 0 0 1) or (quat X Y Z angle), this represents an object that is aligned to world space. The best way to describe how it works is a sphere with an arrow pointing from the center out to the surface. The XYZ value is not a rotation but a vector or position, this will represent the position of the point of the arrow on the surface of the sphere and the angle is the rotation around the arrow.

Quaternions are the preferred method for representing rotations in 3D space because of the inherit problems of the Euler method. Quaternions use four values to describe a rotation. X, Y, Z and angle where X, Y, Z are divided from complex numbers and angle is a scalar value. The best visual reference of how this works would be a sphere with an arrow pointing (unit arrow) from the center to the surface. X, Y, Z describes the rotation about the (unit arrow) and angle is the rotation along its length.

Describing a rotation using quaternion allows for only two possible solutions, a positive and a negative. This differs from an Euler in that an Euler can have an infinite numbers of possible solutions for the same rotation.

To better describe how this works you need to know that a quaternion cannot be wound up like an Euler angle can. If we were to rotate a quaternion a full 360 degrees, what you will actually get is a rotation from 0 to 180 degrees and then from -180 to 0 degrees. So if we were to rotate an object from 0 to 270 degrees the result will be the object rotating backwards from 0 to -90 degrees since there is no + 270 degrees. A quaternion will always try to take the shortest way to get to any given rotation. This is a limitation that is easy to get around by just setting more keys on smaller rotations.


 



Because of the way quaternions are calculated, they do not suffer from the same problem of gimble lock. To test this lets do the same example that we did with the Euler.

Create a box in the top view port so that the X, Y, Z rotation is [0,0,0]. In the motion panel change the rotation controller to T.C.B. T.C.B stands for Tension, Continuity, Bias. We will take a look at these more closely once we have an example to work with. Turn on auto key and move the time slider to frame 10. With the coordination system in world, rotate the Y axis to 90 degrees. Move the time slider to frame 20 and rotate the X-axis to 90 degrees. Now slide the time slider between frames 0 and 20 and see what the result is.

You will notice that because there is no problem with gimble lock the rotation of the box is as we would expect. The reason quaternion or T.C.B. controllers are not used more in animation is because of the lack of function curves. Even though the function curves in the Euler controller were not what we expected, they do provide an illustration of the rotation flow through the scene. this is usually enough for the animator to get what they want. The values of quaternion rotations are not easily represented in a set of function curves because they are derived by complex numbers and don't make much sense in a visual way.

The TCB controller uses tension, continuity and bias to control the flow of the rotation through a key. The controller in Max looks like this. Tension will pull the flow of the rotation tighter or looser to the key. This has a similar effect as slow in and out or fast in and out in the Euler controller. Continuity will make the rotation over shoot either side of the key if it is turned up or sharper through the key if it is turned down. Bias will force an over shoot on either one of the sides of the key. At first learning the effects of tension, continuity and bias con be difficult but once mastered you can have as much control over the rotation as a Euler. The problem is still not having a usable function curve to see the flow of animation through the scene but instead having to visualize it one key at a time.