|Professor Bunsen explains Maya's curve editor to Beaker|
This is one of those blog posts I'm writing in the hope that I've foolishly overlooked something obvious. Where some smart person would reply with "Hey n00b just click these 3 checkboxes and bada-bing you're all good".
Where do I start? I'm not an animator, but I need to be one for our current game project. I'm animating characters for a first-person action game we're building in Unity 5.
While a lot of the motion is specific, in many cases the player controller input drives movement, like looking around, and turning the character, etc.. So these actions need to use very high precision linear animations for a lot of different reasons.
In pursuit of trying to get all that movement correct we ran into tangent & curve issues in Maya that caused a fair amount of pain.
If you animate a character in Max or Maya, you probably use IK and a control rig on some (or all) of the skeleton. When it comes time to export clips to Unity, normally you would bake everything down to the joints, either inside Maya, or upon exporting an FBX file.
And that's where the fun begins.
The first sign of problems cropped up when I needed to do a very short, precise animation that switched between two poses. The animation was three frames, where the first frame is a reference pose, and the next 2 frames are the target pose.
My first inclination was to set frames 2-3 to Linear Tangents, both in & outgoing. In Maya's curve editor it looked right. But once we had it in Unity it was doing really weird stuff.
To check, we imported the FBX into 3ds Max and saw a big difference. Here is the same FBX file side-by-side in both curve editors:
|Seriously, who is responsible for this?|
Really? Yes, this is specifically a problem with how linear tangents are handled (and displayed) after the baking process in Maya.
Maya was lying. Regardless of what tangent type is selected, once baked your selected tangent type will revert to Auto.
This little gremlin would rear it's ugly head again, when a few days later I had a joint rotation that had a linear curve, but once baked, the first & last keys would reset back to auto tangents! This is what I'm talking about in a simple example:
No idea why this happens. As you may know, there's two ways to bake keys in Maya. When you have an IK control rig, it's nice to use "Bake Simulation" to bake everything down to the joints. Then you can delete all the controls and be left with nice clean joints to export.
Or, you can skip all that, and let the FBX Export bake your animation (not as elegant, you can select the joints and use Export Selected, but it may still include control rig elements).
Now, you would think that either of those baking options would produce the same curves result, right? Wrong.
In the most aggregious case, I had a turning animation where the character's hips would rotate from 120deg left to 120deg right. We use this as one of the axis of turning for when our character looks around.
The hip joint is rotated off cardinal axes in the character's normal pose (this is a Mixamo rig). If you turn the upper body from left all the way to the right, your hip joint would rotate on world Y (up) axis instead of local. So you would naturally end up with curves on all 3 axes.
What could go wrong? Well, here are the Maya rotation curves on the hip joint from using Bake Simulation vs. just FBX Export (with bake option checked):
|Continuity be DAMNED|
Aye Carumba! How could the animation you saw above be represented by those curves? What is that, gimball lock? I have no idea what I"m looking at here.
And that's where things get serious. Is this just bad math in Maya?
Usually this is where I step back and say "ok, there's no way this could be the software, we must be doing something wrong"... only to arrive back at the same point. So then I thought, what if I did the same animation in 3ds Max, would the curves look the same?
After a re-building the control rig & setting up constraints in Max, I created the same exact animation of the hip rotation (Note: in Max, there's no way to internally Bake Simulation like in Maya, you can only export FBX to bake).
Once again we re-import the FBX back into Max and lo & behold, look at the (vastly improved) hip joint rotation curves:
|Order is restored in the galaxy.|
So let me make sure I have this straight:
1) Two 3d packages from the same company
2) Both cases using Euler rotation controller on Hip joint
3) 3 different curve/tangent results from the same joint in the same animation
See, this is the kind of thing that will rapidly accelerate the aging process for an old art dude like myself.
So now, please tell me I missed something really simple. Or stupid. I would gladly take either at this point.
(special thanks to my collegues at Digital DNA Games for the endless support and assistance in untangling this hella knot).