Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How do i get my character's bones to map properly onto an avatar?

Discussion in 'Animation' started by Nanako, Dec 23, 2014.

  1. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    I'm using a character created in makehuman, and the automated avatar creation from the armature isn't working optimally.

    The "Shoulder" slots are mapped to the clavicle bones. The rig has both clavicle and deltoid before the upper arm, it seems like unity only supports one bone between arm and spine, am i wrong? If so i'd like that one to be the deltoid bone, rather than clavicle. but it'd be ideal to have both


    The eye bones don't map at all, those slots are just left blank

    on each hand:
    index finger is mapped to thumb
    middle is mapped to index
    thumb is mapped to middle
    pinky is mapped to ring
    ring is mapped to pinky.

    The hands are seeeeriously screwed up.

    The bone names look pretty fine too, i don't know why unity can't figure this out:

    Anyways, i can fix all of this stuff with manual configuration of the avatar, but i sure as heck don't want to redo this every time i reimport stuff. And as mentioned in my other thread, Copy from Other Avatar doesn't seem to be working

    I think it would be prudent to rename all the bones on the armature within blender, so that it will import correctly without configuration in unity.

    Can someone tell me exactly how to do this, what bone names will reliably work, etc?

    also, what happens to keyframe data in unity for bones that aren't mapped to avatar slots? are they just ignored and fixed at 1,0,0,0 ?
     
  2. medhue

    medhue

    Joined:
    Aug 24, 2014
    Posts:
    176
    Hey Nanako,
    Ok, I'm pretty confused here. You are using Makehuman, and you are using their skeleton/armature? I would not use their armature. What I would do is rig that MakeHuman mesh to the Rigify armature, which is compatible with the humanoid rig in Unity. Actually, what I did was make my own Unity rig, from the default Secondlife rig. I just added fingers and a jaw to that rig. This allows me to easily convert my Secondlife animation to Unity.

    At the very least, I would rename all the bones on your rig to fit the Unity standard, of course with Blender's extentions of .L and .R.

    To your question, yes bones that don't match are ignored, but you can actually use and animate them, by using masking.
     
  3. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    I was considering this, but it doesn't seem to offer much in the way of gain for my effort, am i wrong? What does it offer that i can't just accomplish with renaming
    I was al.so unsure of what to do with the vertex groups that are mapped to bones which would no longer exist, is there an automated way of merging them?

    But what IS that standard? as shown in the image above, my finger bone names seem to match pretty well.

    Could you elaborate on this? I was wondering, especially regarding bones which aren't part of the humanoid skeleton at all (such as bones for a cape, hair, or a weapon)
     
  4. medhue

    medhue

    Joined:
    Aug 24, 2014
    Posts:
    176
    I don't know that you gain, other than having a bone structure that converts easily to the humanoid rig. If a bone has weights, which is not converted to a standard bone on the humanoid rig, then you will have issues with that weighting. Please do remember that I'm not much different than yourself. I can only comment on what I've experienced, and that information might not be exactly right. So, take what I say with a grain of salt.

    Well the standard is the humanoid rig. I have no idea why those finger bones aren't automatically matching.

    Ok, here, again I can only talk about what I've done. I've created hand poses that can be masked over any humanoid rig, and change the hand poses. That's a simple use of the bone masks. I've also created expressions for the UMA rig. In this case, UMA has their own custom rig, but can also be configured to use the Humanoid rig. So, the body uses the humanoid rig, and the face is masked off. In the animator controller, I have 3 layers. The first layer is blank, because it has no masking option. 2nd layer has all the humanoid body movements with a mask that masks out the face for the UMA rig. 3rd layer has all the facial expressions for the UMA rig, and it masks off everything except the face bones for the UMA rig. This set up allows me to use the humanoid rig body motions with UMA facial expressions. You could do the same or similar for what you are talking about.

    I hope this helps.
     
    theANMATOR2b and Nanako like this.
  5. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    I do not know much about makehuman. If is appropriate, but just to say ; I was thinking that there is or will be a new 2015 book about character's bones. I purchase it in pre-order but the book is not ready yet. But in this days there is 80% discount at packetpub so is cheap (4eur) and probably is specific to this subject.
     
  6. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    Bumping this thread.

    I've since thrown my rig away and made a new one, based on the rigify metarig, from which i've removed some bones and added some IK constraints of my own.

    But anyways, right now, things seem to be vastly improved. The fingers map properly for a start. Everything does now, except the eyes and shoulders.

    I have only one shoulder bone (per side) and they are named "shoulder.L" and "shoulder.R"

    Their name contains shoulder, which is also the name used in the mecanim humanoid rig. And they are between the chest and upper arm bones, and they angle upwards at a ~20 degree angle

    I'm not sure how much clearer i could make that. The automatic avatar generation should be picking them up, but it just isn't. The avatar's shoulder slot is left blank.

    I'd appreciate some technical insider insight from @Mecanim.Dev

    Also just to reiterate, as previously mentioned, yes i know i can configure the avatar and manually assign those bones. But that is one extra step i'd have to do every time i import. I want to make things "just work" and have all the bone slots accurately populated automatically.
     

    Attached Files:

    theANMATOR2b likes this.
  7. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    I also can't get the eyes to populate despite naming them exactly as in the avatar configuraiton, "Left Eye" and "Right Eye"
     
  8. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Glad to see your making progress Nanako.
    I know I work in a different 3D package - but this may help. What are your shoulders parented to?

    A common problem with matching Max's default biped setup with mecanim humanoid structure is the hierarchy parenting of the shoulder (clavicle) bones.

    The default structure for biped shoulders has the clavicles parented to the neck bone. (yes that's odd)
    The correct biped setup is called triangle neck (found under the structure rollout) - which correctly parents the clavicles to the upper most spine bone.


    upload_2015-1-6_18-19-9.png
     
  9. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    My character's spine has four bones, from lowest to highest, (and also in chain order) Hip, Spine, Chest, and Neck. They are shown here:



    The third one up, the largest one, is the "Chest" bone. This is what the shoulder/clavicle bones are parented to. Here's another example with them shown:



    Note the little dotted lines leading to the tail of the chest bone

    Something interesting to note here, is that although the neck is a child of the chest, it's not connected to it. I don't know whether this could be affecting things. might connecting them impact anything?
     
    BrandyStarbrite likes this.
  10. medhue

    medhue

    Joined:
    Aug 24, 2014
    Posts:
    176
    You know you can configure the rig yourself in Unity? I can't really say what the issue is with the shoulders or eyes. Maybe, if I had a look at the blend file, and imported the rig myself, then I might find what's wrong, but I wouldn't bet money on that. I'm medhue1 on Skype, if you want me to look at it.
     
  11. medhue

    medhue

    Joined:
    Aug 24, 2014
    Posts:
    176
    Ok, I just did a test. I just created the metarig in Blender. Then, I just exported it as an FBX. In Unity, I drag it in, and choose Humaniod in the rig set up. I then go and check the configuration. Everything matched up, but the default metarig doesn't have eyes, or a jaw. So, just for the hell of it, I go back into Blender, extrude 2 eye bones from the head bone, disconnecting them both, and labeling them Eye.R and Eye.L. I export that rig as FBX and bring it into Unity. In Unity, it configured the eyes properly too.
     
    chelnok and Nanako like this.
  12. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    me and medhue spent a fair bit of time chatting, but we're yet to figure it out. We've reproduced that my rig fails consistently, and a fresh metarig works consistently. i'm currently in the rather slow process of repeating all the reshaping i did, to see where it breaks
     
  13. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    Aaaand done. It did not break.

    No closer to finding out WHY it originally broke, but now i have two completely identical armatures, one which imports perfectly, and one which imports imperfectly. Ugh

    I guess the important thing is that it works, but since i didn't do anything specific to fix it, i'll have no idea how to repair it if it somehow breaks again ;-;
     
    BrainSlugs83, theANMATOR2b and medhue like this.
  14. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    fastforward two days, it's broken again, in exactly the same manner as before. Shoulders and eyes fail to map, everything else does.

    I've kept a copy of the rig since my last post, and that old copy still maps perfectly. Something i've changed has broken it, attempting to figure out what. I'm slowly regressing the armature.

    This is very frustrating and buggy
     
  15. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    What could you have changed since you got the rig working? - other than adding 'extra' bones which mecanim ignores anyway. Your nearly there - I dont understand changing a rig once it works as desired. Update when you figure it out.
     
  16. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    edit nevermind, still figuring it out
     
    Last edited: Jan 10, 2015
  17. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    earlier, the rig was mapping perfectly as desired, but it was very basic and far from complete. i've been adding IK, mechanism and control bones since then. there was still much changing to be done.
     
  18. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    Okay, progress so far, i've narrowed it down to the armature modifier.

    Whenever an armature modifier is present linking the mesh to the armature, the bones do not map properly to the human rig.

    Whenever that modifier is not present, OR it points to a different armature other than the one i export, then the bones map perfectly. But in both of these situations, the mesh does not animate, because it is not properly associated with the armature.

    The only logical conclusion i can draw from this, is that mecanim is somehow looking at the character mesh for clues about how to map the bones, even though that isn't mentioned here: http://blogs.unity3d.com/2013/02/07/automatic-setup-of-a-humanoid/

    Either that, or mecanim is fundamentally broken. which doesn't seem too likely.

    Next step is to try modifying the mesh, and try rigging other characters to the same armature, i guess.
     
  19. Nanako

    Nanako

    Joined:
    Sep 24, 2014
    Posts:
    1,047
    Hooray, i've solved it.

    My suspicion was right, the bone assignment was looking at my model, not just my armature. I found some issues with the character mesh. Specifically,y, the bones that were failing to populate did so because they had no vertices weighted to them. This happened due to not updating the vertex groups named when i renamed various bones

    The importer seems to optimise out any bones that have no vertices, and doesn't put them into bone fields on the humanoid rig. That is ultimately what was wrong here. I didn't see that fact stated anywhere in documentation

    It's also worth noting that in all previous cases where this appeared to be working perfectly, that was actually caused by the mesh not being properly linked to the armature, and therefore the bone assignments were based purely on the rig and took nothing from the mesh. In those situations, animations did not work correctly because of this missing link.

    I now have it working fully and perfectly.

    I blame this half on me, and half on unity for not documenting things properly :p
     
  20. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Great troubleshooting and documenting Nanako! I'm sure this thread will be very helpful and referenced extensively by blender users running into similar issues in the future.
     
    BrainSlugs83 likes this.