Matt Estes is no stranger to the Animation Mentor Blog (or Animation Mentor, for that matter). He is an alumnus and our Software and Technical Support Coordinator — with a previous stop at Hive-FX in Portland, Oregon where he was the Lead Animator for the show Grimm. Matt returns to the blog to talk about the dreaded Gimbal Lock. And make note: You can contact Matt through the Support Ticket system for campus and software advice.
What is Gimbal Lock?
A gimbal is a pivoted support which may rotate freely along a single axis. When you combine three gimbals, you achieve the most commonly observed arrangement: Pitch, Yaw, and Roll (or XYZ as you’re probably more used to seeing it.) Simply put, Gimbal Lock is the loss of one degree of freedom which occurs when two gimbals are rotating parallel to each other. Gimbals never actually “lock” — which makes the task of managing this issue that much easier. As it is experienced in 3D animation, there are many ways to overcome this annoyingly common obstacle. I’ll begin with a brief explanation of how to identify Gimbal Lock, and how to avoid animating in a locked state.
You should occasionally change your rotate-tool
Every now and again, change your rotate-tool to the Gimbal setting. This will show you how your gimbals are currently aligned with the world (which is unlike World, Local, and Object modes which do not actually show you how your gimbals are arranged).
You control the key
As you can see, you cannot always rely on your manipulators to tell you exactly what’s going on in your scene. Your greatest tool in preventing Gimbal Lock is, in fact, you! Keep an eye on your channels as you animate (you shouldn’t need me to tell you this). If one of your values is of a significantly different value than the other two — or has passed either +/- 180 units of rotation — you should quickly check to ensure that your gimbals are all still operating independently of the others.
What happens if two of your gimbals have taken that next step and are no longer operating independently of each other? The quick and dirty method is to use the Euler Filter, located under the Curves Menu in the Graph Editor. The filter will check through your shot and attempt to correct any awkward gimbal rotations. As with all situations where you allow your computer to animate for you — be sure to double-check the work.
Another quick fix is to add or subtract 360 units to the rotation value of the impacted channel, as this will usually bring the channel in line with its surrounding keys.
Obviously, there is always the option to hit that big red button and delete the impacted keys and reanimate with a careful eye on the value of your channels. But let’s get to the real reason that you’re here.
You have to pay attention to the right cues
Preventing Gimbal Lock is relatively easy — you just have to pay attention to the right cues. Whenever possible, animate with a y-offset. Our rigs have the y-offsets located directly under the joint in the hierarchy, I recommend making a button for them for easy selection. Use offsets for shoulders, hips, wrists, and ankles if it compliments your workflow. You probably won’t need to use an offset on any other major control — but remember, if you find yourself locking out, you’re just a control offset away from escape!
Take a look at the video above. Bobby Beck demonstrates techniques to avoid Gimbal Lock.
But what if you don’t have a y-offset?
Using a y-offset will ensure that you don’t encounter Gimbal Lock, however, you may not always be afforded the luxury. In most situations I’ve found myself animating in, I did not have y-offsets available to me. To avoid Gimbal Lock, I paid close attention to my values and followed a similar tactic to the +/- 360 trick I mentioned earlier. Here are the steps I would follow to avoid Gimbal Lock and identify it as soon as it happened:
- Work in a copied-pairs/plateau workflow. The benefit here is that you get the timing of stepped tangents. But if you encounter the odd rotations commonly associated with Gimbal Lock, you will see the joint flip in the transition between two frames. A two-frame or higher transition is required here. Note: You can also just work in plateau/splined tangents and achieve similar results.
- Check your channel editor. When you see a joint flip, check your channel editor to see which value is out of line (it will likely be the y Rotation).
- Open your graph editor. This is important: Open your graph editor and select the knot that is significantly separated from the rest of your graph. Manually drag that knot to a point where it is back in line with your graph and the pose is replicated. This will be near, but not always, 360 units.
Additional tips to avoid Gimbal Lock
Remember these useful tips:
- Know your rotation orders. Joints always have a rotation order — XYZ, ZYX, YXZ, etc. This means that the more you progress down the chain, the fewer the channels that are impacted: X impacts X, Y, and Z; Y impacts Y and Z; etc. Gimbal Lock occurs on the second gimbal. For example, in a joint with an XYZ rotation order — it will push the Z toward the X; and when they overlap, you will lose a degree of freedom.
- Pay close attention to the values of your rotation channels. If one is significantly different from the other two, you are likely approaching or experiencing Gimbal Lock.
Careful planning and thoughtful execution are your best friends
You may notice that the most effective tool in preventing Gimbal Lock is to animate attentively and with great care. You should always approach your shot with a clear idea of where you want the shot to go. Through careful planning and thoughtful execution of those plans, you will find yourself having trouble remembering the last time you ran into Gimbal Lock. Happy animating!