KhronosGroup / UnityGLTF

Runtime glTF 2.0 Loader for Unity3D
MIT License
1.81k stars 490 forks source link

Humanoid import bone mapping is missing a specific direct mapping #751

Closed Phlegmati closed 3 months ago

Phlegmati commented 3 months ago

I am using UnityGLTF 2.12.0 for Importing .glb model files in Unity 2022.3.23f1

I've got several model files: 1.) One, which is rigged & skinned with the mecanim humanoid bone hierarchy (Hips > Ribs > Chest > etc ...) 2.) Another, which is rigged & skinned with meta avatar bone hierarchy (Spine.001 > Spine.002 > Spine.003 > etc ...)

If I export those files as .fbx and import it in Unity (editor, not runtime), I can choose "Humanoid" rig configuration and may need to retarget some spine bones - but both files are getting retargeted really well.

If I export those files as .glb and import it in Unity (editor, not runtime), I can choose "Mecanim Humanoid" and it always fails, stating that the "Hips"-bone is missing [It is not].

Did I miss a step configuring/exporting in Blender, in the Unity Editor or am I missing an extension?
As stated in the changelogs for version 2.11.0: "- add: support for humanoid import for Meta avatar bone hierarchies" - there should be a working solution for that.

Thank you guys in advance and for your work so far. I will appreciate any advice given!

Phlegmati commented 3 months ago

Sorry, found out myself:

The ErrorMsg is a bit misleading, it states that the Bone named „Hips“ is not found - when the importer itself actually has a lookup table, with different naming conventions:

hips -> Hips Hips_jnt -> Hips mixamorig:Hips -> Hips

but never actually looks for „Hips“ with a capital Letter „H“.

To be sure your bone hierarchy is readable for the importer, take a look at „AvatarUtils.cs“ which has the dictionary „HumanSkeletonNames“ with different naming conventions.

hybridherbst commented 3 months ago

Thanks – we should fix that! Unfortunately Unity doesn't give access to "whatever the FBX importer does" in terms of human skeleton mappings, so some of it needs to be reimplemented on a case-by-case basis.

@Phlegmati could you please post the original model that made problems so that we can reproduce the issue?

pfcDorn commented 3 months ago

hey @Phlegmati, can you please test your scenario with this comment? That should be fix it :)

Phlegmati commented 3 months ago

Hey @pfcDorn!

Yes, worked indeed, thank you!

pfcDorn commented 3 months ago

Nice, good to hear :)