Search Unity

Mecanim Humanoid Rig Issue

Discussion in 'Editor & General Support' started by mr_Necturus, Dec 29, 2013.

  1. mr_Necturus

    mr_Necturus

    Joined:
    May 17, 2010
    Posts:
    2,954
    Hey guys.

    I have exactly same FBX file used as base of Humanoid and Generic rig type animations.
    But as you can see on the in the picture there is a difference between humanoid (left) and generic based characters.
    When generic based character much original 3D Studio MAX look but Humanoid make problem.

    Is here any explanation about this issue and way to make humanoid based animation mach original better?

    I think this question more addressed to Unity Team guys. Hope this time I will have an answer.

    $Humanoid_animations_problem.jpg

    Actually all humanoid animations are slightly different from original animations. But in this specific one it looks pretty unusable.
     
    Last edited: Dec 29, 2013
  2. Jmonroe

    Jmonroe

    Joined:
    Jul 7, 2012
    Posts:
    87
    Have you tried tweaking the Avatar bone rotations?
    Or could it be how Mecanim loops the animation, Mecanim searches for a good fit when looping. maybe try looping different frames? Just ideas.
     
  3. Proportion1

    Proportion1

    Joined:
    Jan 6, 2013
    Posts:
    30
    Hey Mr. Necturus, I have the Props animations asset in the store so i know the problem your talking about. When i configure the rig for humanoid, under the pose button i hit all 3 options from top down (reset then bind pose then enforce T pose). Doing that usually makes the original character look the same during the animation (for me).

    The other major problem is when you re-target a two hand sword animation, because both hands rotate differently to each other, and the rotation is based from the wrist, they wont ever both be on the sword during the whole animation. This is why i dont have 2 hand sword animations in my pack. Its just unusable in a professional situation.

    Mixamo has the same problem: http://www.mixamo.com/editor/new/1785
    Both hands just go all over the place. Its just a disadvantage of re-targetable animations.
     
  4. Robert-Lanciault

    Robert-Lanciault

    Unity Technologies

    Joined:
    Oct 17, 2012
    Posts:
    14
    Hi guys,

    When re-targeting to the original rig, animation should be left unchanged. This is true if you don't have animated bones in between bones defined by Mecanim humanoid structure. You should have waring in the console when importing if this is the case.

    If it is not the case, I would like to take a look at your rig and find where it breaks.

    About re-targeting a "two hands sword" animation, it will most likely take an IK pass to fix the animation when the target humanoid has different proportions. Note that the humanoid animation file format stores the original path/orientation of hands and feet. You can activate the left and right hand IK goals to make hands of the target humanoid hold the sword correctly.

    bOb
     
    theANMATOR2b likes this.
  5. Proportion1

    Proportion1

    Joined:
    Jan 6, 2013
    Posts:
    30
    View attachment $2handswordswing.zip

    We dont change our animations in any way after importing, it does this when you set humanoid. i have used IK setups to try and make it look correct but because of the way the wrists of a character rotate during a 2 hand sword swing, i cant get it to work. I have attached a zipped fbx file of the rig i use in Props Animations doing a 2 hand sword swing. If you can figure out how to retarget this to another character (say the unity dude) and have both of his hands stay where the sword would be, and upload a unity project file showing this, i will give you a free copy of props animations. This offer goes out to anyone that knows how to do this too.

    As you can tell i really want to know how to do this, as i have been asked for 2 handed sword requests and not been able to deliver a game ready animation.
     
  6. mr_Necturus

    mr_Necturus

    Joined:
    May 17, 2010
    Posts:
    2,954
    View attachment 81297

    Interesting that animations in Humanoid mode works much more correctly if you don't map shoulder at all.
    Unmap shoulders and you will see that left hand stick to the sword in 2H animations very well.
     

    Attached Files:

  7. mr_Necturus

    mr_Necturus

    Joined:
    May 17, 2010
    Posts:
    2,954
    For Robert:

    The problem not only hands. As you can see in preview post. If shoulders of humanoid avatar are not mapped to any bones - hands works better. But still there is always a difference between humanoid and generic avatars' animations. Sometimes you didn't pay attention, sometimes its very visible.

    I am not specking of re-targeted animations for any other characters. I am speaking about the same original FBX files which humanoid and general avatars interpret differently.
     
  8. Proportion1

    Proportion1

    Joined:
    Jan 6, 2013
    Posts:
    30
    i just checked my original model on the humanoid character and it offsets a bit as well, i can understand it going funny on a different character but im not sure why on the original model, wierd.
     
  9. Robert-Lanciault

    Robert-Lanciault

    Unity Technologies

    Joined:
    Oct 17, 2012
    Posts:
    14
    mr_Nectrus, can you send me your fbx files? I'll take a look at it
     
  10. Robert-Lanciault

    Robert-Lanciault

    Unity Technologies

    Joined:
    Oct 17, 2012
    Posts:
    14
    I'll look at your 2handswordswing and get back to you!
     
  11. Robert-Lanciault

    Robert-Lanciault

    Unity Technologies

    Joined:
    Oct 17, 2012
    Posts:
    14
    http://www.youtube.com/watch?v=eyGvjPdGazU

    Here is a video showing 2 hands sword retargeting. I did not attach the project since it was too big, but a matter fact is that I did not do anything weird to get to this result. I only activate hand IK goals for position and orientation.

    void Update ()
    {
    if (m_Animator)
    {
    m_Animator.SetIKPositionWeight(AvatarIKGoal.LeftHand, 1);
    m_Animator.SetIKRotationWeight(AvatarIKGoal.LeftHand, 1);

    m_Animator.SetIKPositionWeight(AvatarIKGoal.RightHand, 1);
    m_Animator.SetIKRotationWeight(AvatarIKGoal.RightHand, 1);
    }
    }

    The guy in the middle uses a generic rig (original animation). The guy on the left use a humanoid rig (humanoid animation on original rig) and finally on right mocap Dude (humanoid animation retargeted to a different rig).

    I did not find the sword anim in the fbx file so I parented a sword prop to the left hand for visual reference... it only approximates the sword animation so right hand may not be in exact contact with the sword.

    The video shows a Dude handling sword with two hands that is very close to the original animation.
     
    eDmitriy likes this.
  12. mr_Necturus

    mr_Necturus

    Joined:
    May 17, 2010
    Posts:
    2,954
    Hey Robert.

    Thanks for your effort. Please Give me your mail address I will send to you my 2H FBX file.

    Please pay attention? that if you don't map shoulders - left hand works pretty well. But Humanoid animation is always different in some way then Generic\original. So sometimes it looks "no matter" but sometimes looks not very good as in my "Idle" animation.

    So the question: Why Humanoid and original rigs animation interpretations always are different?
     
  13. Proportion1

    Proportion1

    Joined:
    Jan 6, 2013
    Posts:
    30
    Cool! Mine always looked funny because i only IKgoaled the Left hand to the right. What i dont understand is how your motion is being applied, eg. what are the avatar IKGoals set to? If you could add me on skype (my nickname is "proportion") and like explain all that I will send you the latest copy of Props animations.

    Heaps of people are going to be happy about this that is for sure!!

    But yea i really need that hand right on the target. like at 5 seconds the generic one is on the target and the others are off. I'm making a new fbx and testing if its correctly done (with a sword) now.
     
    Last edited: Jan 10, 2014
  14. Robert-Lanciault

    Robert-Lanciault

    Unity Technologies

    Joined:
    Oct 17, 2012
    Posts:
    14
    The humanoid animation format is completely abstracted from its original skeleton. It has 49 DoF (we call muscles) the represent the body motion. Some more stuff in there like root motion curves and DoF for fingers, but essentially 49 floats for muscles.

    For example we only support 6 DoF (2 bones) for spine. If you rig contains more than 2 spine bones that are animated then this information will be lost when creation the humanoid animation clip.

    If your rig does not have more animated bones than the Mecanim human definition, the resulting humanoid animation should match the original one. You should have a warning in the console while importing if your animation does not respect that.

    This said, I want to take a look at your files and see where it breaks.
     
  15. Robert-Lanciault

    Robert-Lanciault

    Unity Technologies

    Joined:
    Oct 17, 2012
    Posts:
    14
    >>>> So the question: Why Humanoid and original rigs animation interpretations always are different?

    We found something that could explain most of the difference you see. The humanoid auto configuration step that creates the reference T-Pose relies in part on skin Bind Pose. In the case of your character, it seems that local position of bones are different in bind pose than in animation. Among other, you have a big difference for Left Upper Arm. Those local position differences result in retargeting differences.

    We will fix this problem by only using rotation out of bind pose and leave local positions unchanged. Until this fix is available, you can do 2 things:

    1 - use a bind pose that a have same local position of bones than what you have in your animation
    2 - provide a t-pose on frame 0 of your animation. when configuring humanoid in Unity, do a "Reset" in Pose dropdwon.
     
    theANMATOR2b likes this.
  16. mr_Necturus

    mr_Necturus

    Joined:
    May 17, 2010
    Posts:
    2,954
    Thank you for help and time spent for this.

    I just have a one more question. hat you call "bind pose"? Is it position which I use to skin my models, or something else?
     
  17. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    793
    Robert, how do you access the information about the original positions pre-retargeting?