godot icon indicating copy to clipboard operation
godot copied to clipboard

Importing GLTF add fake bones to the skeleton

Open AlvaroEMatos opened this issue 1 year ago • 5 comments
trafficstars

Tested versions

  • Reproducible in: v4.2.2.stable.official [15073afe3]

System information

Windows 11 - Godot v4.2.2.stable - Windows 10.0.22631 - GLES3 (Compatibility) - GeForce GTX 1050 Ti () - AMD Ryzen 5 3600 6-Core Processor (12 Threads)

Issue description

During the import process, when there is an object that is not a joint in the skeleton hierarchy, a fake bone is created in its place, altering the original skeleton hierarchy. Therefore, it is not possible to correctly recover the position of the animated vertex because the bone indexes in the vertex data refer to the original skeleton.

Captura de tela 2024-05-27 163333

Recording 2024-05-27 at 16 38 39

Temporary solution

Create an array that maps the indices of the original skeleton to the modified skeleton.

Steps to reproduce

  1. Uncheck "Use Correction" at "debug.gd" attached to "beast/Armature/Skeleton3D/body"
  2. Play the "ArmatureAction" animation in the Animation Player

Minimal reproduction project (MRP)

skin_collision.zip

AlvaroEMatos avatar May 27 '24 21:05 AlvaroEMatos

Can you work around this by ensuring all the vertices in the mesh are bone influence weighted?

Godot Engine cannot handle unweighted faces correctly. I have selected the faces that aren't weighted.

If you separate them into separate objects that'll convert them to bone attachments which are ok too.

image

fire avatar May 28 '24 00:05 fire

Can you work around this by ensuring all the vertices in the mesh are bone influence weighted?

Godot Engine cannot handle unweighted faces correctly. I have selected the faces that aren't weighted.

If you separate them into separate objects that'll convert them to bone attachments which are ok too.

this solution works perfectly, thank you!

AlvaroEMatos avatar May 28 '24 01:05 AlvaroEMatos

To make it clear what I did as @fire suggested. In blender, press Object>Parent>Clear Parent and Keep Transformation, after press Object>Parent >Armature Deform and paint the weights for all non weighted meshes, now in godot the meshes are children of skeleton and using skinign animation instead of using bone attachment. The best would be to continue using bone attachment and reduce the skining animation overhead for complex models.

AlvaroEMatos avatar May 28 '24 18:05 AlvaroEMatos

If you separate them into separate objects that'll convert them to bone attachments which are ok too.

@fire is there way to prevent this adding same-named bones other than weighting them, or should I just live with it? (or should this be a new issue itself?)

I have dozens of objects parented to single bone(named "root") and now each every one of those create extra bone and use it as BoneAttachement3D. Not too problematic but bone list is now so messy and might takes few more ms to parse bone tree for my use. So far just adding suffix on mesh so it's easier to filter out.

for some extreme case...:

image

jupiterbjy avatar Aug 17 '24 16:08 jupiterbjy

to @lyuma too it is a bit odd, but it doesn't seem that harmful. I wonder how damaging it is to fix it.

fire avatar Aug 17 '24 17:08 fire

@AlvaroEMatos This issue is fixed by my PR #104184. Here is a comparison image. On the left side is the current master, or my PR with the compatibility option set. On the right is my PR without the compatibility option enabled.

Image

The fix in my PR #104184 is better than PR #92452 because PR #92452 just comments out the call to Skin Tool, effectively disabling the code entirely, and breaks the case of skeletons with a non-joint bone in the middle of the tree of joint bones. My PR fixes the problem in a better way, which should work for all cases.

@AlvaroEMatos If you want, you are welcome to test, review, and approve my PR.

@fire There is no damage to fix it with my PR #104184, because it includes an option that preserves compatibility.

aaronfranke avatar Apr 29 '25 01:04 aaronfranke