We are trying to import an animation from Maya to Unity, in which the character takes a picture. We need the bones’ positions and rotations to exactly match the source take, including fingers, because the animation will be seen from up close.
In generic mode, the bones are correct. However, in humanoid mode, they are wrong.
We need to use humanoids, because we use inverse kinematics. We can’t stay in generic.
Here is some basic background information:
- The animation file is called “TakePhoto.fbx”
- The reference avatar, in T-pose, is called “TPose.fbx”
- The Maya rig is based on Morph3D’s MCSFemale model.
- Ultimately, we are trying to apply the animation back to the Morph3D model.
- Animation compression is turned off everywhere.
- Optimize game objects (from rig) is turned off everywhere.
- Apply root motion is turned off everywhere.
- We get no warnings or errors on import of any model or animation.
Our avatar definition (same in TPose / TakePhoto) seems correct:
(The right hand is mirrored).
Note that we are Enforcing T-Pose.
In order to debug, we created a script that shows skeletons in the inspector, and another one that compares bones position and rotation between two skeletons.
We have 5 test models so far. None of them have the same behaviour as the reference generic animation.
Here they are at a crucial point in the animation, where all fingers are solicited.
Legend:
- A green dot indicates that the bone’s position and rotation is identical to the reference.
- A yellow dot indicates that the bone’s rotation is correct, but its position is incorrect.
- An orange dot indicates that the bone’s position is correct, but its rotation is incorrect.
- A red dot indicates that neither the bone’s position nor rotation is correct.
We have a comparison sensitivity threshold, which right now is set to 1e-5. Even at 1e-1, we get orange / red dots. We are comparing position.xyz / rotation.wxyz.
We use incremental comparison to know where the process breaks. In other words:
- Test #1 is compared to Reference
- Test #2 is compared to Reference
- Test #3 is compared to Test #2
- Test #4 is compared to Test #3
- Test #5 is compared to Reference
The reason for test #5, which is basically test #3 but imported directly from Maya rather than from FBX, is because this question on Unity Answers implied they got better results when baking directly from Unity. That doesn’t seem to be the case.
Since Test #3 is all green, we know that the problem doesn’t arise from retargetting from one model to another. Instead, as indicated by the errors in Test #1 and Test #2, the problem arises simply from using the humanoid system, even without any retargetting.
We’re aware retargetting is bound to have some discrepancies. However, we see no reason why simply using the humanoid system causes rotations and positions to be wrong. In other words, we want Tests #1 and #2 to be all green.
The one thing we haven’t experimented with is the muscle settings, which are for now all left at default (reset).
What are we doing wrong?
How can we correct the animation in humanoid?