Search Unity

Need an example of mecanim-compatible skeleton for blender

Discussion in 'Asset Importing & Exporting' started by neginfinity, Feb 19, 2018.

  1. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,571
    I need an example of mecanim-compatible armature in blender. I'm talking about humanoid animations, of course.

    Basically... one thing that is bothering me is rotation and location of feet and clavicle bones, neck, etc.

    I'm looking for an example setup that won't result in mecanim breaking character's neck, straightening the spine, smashing feet into ground, etc.

    Any examples? Maybe someone is interested in sharing experiences?
     
    BrandyStarbrite likes this.
  2. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,571
    Uh, does no one use blender with mecanim?
     
  3. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,792
    I do, but I'm not really that happy with my setup, so I'm not sure if sharing it will help you.
     
  4. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,571
    Hmm.

    Care to share some details anyway? You might have some pieces of information I could use.

    Basically few things that bother me right now are:

    Clavicle/Shoulder Bones:
    • Parallel to ground or following shoulder slope?
    • Originate from spine, free floating or originate from where clavicles are supposed to be?
    Spine:
    • Straight or following spine curvature?

    Feet bone placement:
    • Parallel to ground or tilted down?
    I might be overthinking it, of course.

    See, without using mecanim, those don't matter.

    Also, perhaps someone like @Mecanim-Dev could chime in on the matter?
     
  5. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,792
    Following shoulder slope. Sort of. Actually kind of in the middle between slope and parallel. I think Mecanim wants them to be parallel though, but I had slightly weird behaviour when I made them completely parallel, at least I think so, it's been a while. I struggled with this as well.
    Free floating, in the general area where clavicles are supposed to be. I don't think this one matters too much for mecanim. So put them at whatever place make your model deform nicely.
    Almost straight. Again this is something I struggled with. I'm not sure if I'd recommend you do it this way.
    Tilted down. I also have a bone for toes, which is parallel. This one I'm a bit more confident that it's the way to go, since I didn't really have a lot of issues having it set up this way and having the foot bone start a bit higher up is also closer to reality.
     
    neginfinity likes this.
  6. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,571
    Alright. Thanks for the response. This is useful.
     
  7. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
  8. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,792
    That blog post is slightly confusing. For example in the T-Stance section it says "– Feet on the ground parallel to z axis", but in the image that goes along with that section the feet bones are tilted toward the ground a bit. ;)
     
    BrandyStarbrite likes this.
  9. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,571
    This actually doesn't give clear answers.

    I saw the article before, and while it explain how mecanim works (which is kinda like I expected - mapping rotation to muscles), it doesn't really explain expected rig setup.

    The blog article implies that rest position of a rig doesn't really matter and it should work on anything vaguely humanoid.

    Is this correct? Because I definitely recall running into issues with hunchback characters, or characters that stand on toes, like werewolves.
     
  10. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    yes it will work if you don't mix animation clip made for another character, if you try to retarget a motion made for a werewolf which have a special T-pose on a normal human you could get some retargeting artifacts like the feets not bending as expected.

    it doesn't matter to some degree, if you are close to T-pose almost all motion made for other character should work, but if you rest pose doesn't look like a T-pose then there is a high chance that motion made for another character will look weird on your character.

    So it's important if you are planning to re-use motion(retargeted motion) from another character.
     
  11. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,571
    Is there additional information about muscle parametrization used in mecanim and "muscle space" described in the blog?
     
  12. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    Not that I'm aware of
     
  13. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,792
  14. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,571
    Hmm.

    I'd be interested to know how mecanim determines "0" and +-1 positions for a specific muscle.

    I'd assume that T-pose corresponds to zero on all muscle groups. Past that point you probably apply predefined rotational ranges to all groups of muscles to determine maximum/minimum.

    During conversion to muscle space you'd probably grab model space rotations (meaning relative to root), and multiple them by inverse quaternion of rest pose rotations (extracting change in rotation relative to rest pose), and then break the resulting rotation in pieces to map it onto muscle groups. This can be done in parent space as well, thinking about it...

    Is my guess about right? Or is there a difference somewhere?

    The answer to this question would pretty much explain mecanims behavior when handling subtle variations in T-pose.
     
  15. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    Not exactly, when all muscle are set to 0 the character is in relax pose, half way between maximum extension and minimal extension. In the avatar configuration tool switch to Muscles & setting tab, there you can change the value of all muscles to see how the character move.

    relaxpose.png

    About how the muscle value is computed, it a little bit more complicated than that but you got the general idea right.
     
  16. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,571
    Ah-hah. Aka "riding a bike" pose. This is useful.

    One more question: If T-pose does not correspond to Rest pose, how is rest pose derived from T pose? Does mecanim assume that T-pose corresponds to specific set of (predefined) muscle values?
     
  17. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    not at all, the T-pose is only used to compute the set of pre and post rotation to orient each joint correctly in muscle space which is a normalized space for all humanoid rig. Joint have limits that control what is the maxium extension and minimal extension, you can tweak them in the Muscle & Settings tabs when you configure your avatar. If you select a specific muscle you should see a muscle handle appear in the scene. Based on thoses limit the Rest post is basically when the corresponding joint is aligned on the white axis of the muscle handle

    musclehandle.png
     
    neginfinity likes this.
  18. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,571
    Wait, so does this mean that mecanim basically assumes that all humanoid characters have the same rest pose?

    The way you explain it, it looks like T-Pose is mostly used to figure out mapping between character bone orientation and mecanim, but the way you describe it, it seem that if I plug in a hunched back character with spine bones that follow spinal cord, the system will simply assume that the spine is bent forward and will straighten it.

    Or am I mistaken?
     
  19. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    I should add that at maximum extension the corresponding muscle value would be 1,at minimal extension it should be -1, and 0 is 0, the muscle range doesn't have to be symetric.

    Also muscles values are not clamped, so something you can see a muscle value that is greater than 1 or lesser than -1 depending if the orignal motion for this transform goes beyond the maximum/minimum limits.
     
  20. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,571
    Yeah, I understood that part, but the main reason for this question in the first place was trying to figure out how to deal with meacnim when it is applied to quasi-humanoid types, like werewolves, wererats and other "hunch back, stand on toes" characters. Another good example of such character would be fallout deathclaw.

    Basically, I'm always tempted to make spine bones follow spinal cord, which may be a mistake. In this kind of arrangement, spinal cord pose should correspond to "muscle position 0". However, if Mecanim does not assume that T-pose is "muscle position 0", and instead of trying to derive "bike pose" from it, then the system - depending on how it is implemented - may decide that the skeleton is bent forward, and would attempt to fix it.

    That's basically the reason for questions --> I want to get better understanding how based on defautl pose the movements are mapped to muscle space.
     
  21. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    Spine bone doesn't have to be straight in line, as long as your character look like he standing straight that should be fine. If in your T-pose your character have hunch back, it will also have a hunch back if you try to retarget a motion made from a normal character. Those constraint are not hard limit that cannot be broken. If you broken them and it does make sense for you character that fine.
    I did a test with a run motion retargeted on a hunch back character, even if the motion was made on a character with a normal back the retargeted motion look like a hunched back character running.

    hunchbacktpose.png

    In the following picture I do use the same run motion apply to a normal character and a hunch back character.

    hunchbackrun.png
     
    BrandyStarbrite likes this.
  22. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    Also character standing on toes should not be an issue as we compute the distance between the ankle and the floor when you configure your character, the same offset is reapply when we retarget a motion. We have to do that to have good feet contact on the floor when we retarget motion otherwise some model could end up with their feet under the floor or floating above.

    The system is high heels compatible :)
     
    BrandyStarbrite likes this.
  23. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,571
    Alright, thanks for comprehensive explanations.

    While I do still have moments where I'm uncertain about minor details, your responses cleared up most things.

    I'll remain subscribed to this thread, and will post followup questions if something comes up.

    Thanks for the responses.