makehumancommunity / mpfb2

MPFB2 is a free and open source human generator for Blender
http://static.makehumancommunity.org/mpfb.html
Other
317 stars 38 forks source link

Support eyes and jaw bones for game base rig #28

Open grascm opened 2 years ago

grascm commented 2 years ago

This is useful for creating the most cheap and basic facial animation in games, and those bones are natively supported by Unity mecanim system.

joepal1976 commented 2 years ago

Do you happen to have a link to documentation or bone setup for mecanim? I'm thinking maybe it'd be easier to create a separate mecanim rig based on the game engine rig, since modifying the existing one might have unintended side effects for existing characters.

grascm commented 2 years ago

I am sorry, but this part is not well documented on Unity website.

OfAllTheBars commented 2 years ago

I think I can help. The relevant pages of the documentation are...

https://docs.unity3d.com/2020.2/Documentation/Manual/AnimationOverview.html https://docs.unity3d.com/2020.2/Documentation/Manual/ConfiguringtheAvatar.html

(there are others). It takes a bit of understanding.

Simply put when Unity imports a model with a rig you can set whether it is a Generic or Humanoid rig. If you choose the latter it will try and map the bones in the model to Unity's Avatar model. (This can be thought of as a sort of 'standard' human armature.) Any bones that can't be mapped are still imported and used in animations etc. The benefit of using humanoid rig / avatar is that you can share/retarget animations from one model to another - even if they have different bone naming. (The avatar in effect provides the translation.)

From experience Unity does a pretty good job at mapping bones to the avatar. For example, all the bones in the MakeHuman GameEngine rig map correctly.

If we include bones called 'jaw', 'eye_l', and 'eye_r' (or lefteye/eyeleft etc) AND those bones have weights on the mesh then they imported and mapped to the avatar correctly. (No weights and they do not map.)

I've checked this all manually (exporting / importing via FBX files) and it worked as I would expect.

I'd support making this a new rig, rather than updating the current GameEngine rig, however, I think it would also be good to do a bit more research to see if Maxamo and perhaps Unreal would need anything else done. (I can do this but not immediately.)

Finally, the Unity documentation does not show the whole Avatar model - it's only displayed in Unity itself. I've included screen shots below.

image image image

(The right hand is the same as the left.) Also note that the jaw, eye left, and eye right are the only avatar bones missing from the GameEngine rig.