godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.85k stars 20.15k forks source link

Importing GLTF add fake bones to the skeleton #92447

Open AlvaroEMatos opened 3 months ago

AlvaroEMatos commented 3 months ago

Tested versions

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

fire commented 3 months ago

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

AlvaroEMatos commented 3 months ago

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 commented 3 months ago

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.

jupiterbjy commented 3 weeks ago

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

fire commented 3 weeks ago

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