KhronosGroup / glTF-Blender-IO

Blender glTF 2.0 importer and exporter
https://docs.blender.org/manual/en/latest/addons/import_export/scene_gltf2.html
Apache License 2.0
1.49k stars 317 forks source link

GLTF Export Animation Wrong Bone Transforms (Rigify) #2223

Closed InnPatron closed 5 months ago

InnPatron commented 5 months ago

Problem

Export operation:

bpy.ops.export_scene.gltf(
        filepath=exportPath,
        export_format="GLTF_SEPARATE",
        export_bake_animation=True,
        # Does not appear to be the issue?
        export_reset_pose_bones=False,
        use_renderable=True,
        export_def_bones=True,
        export_apply=True,
        export_anim_slide_to_zero=True)

Reproducing

  1. Download min-repo.zip and export with export.sh (calls a custom game-export.py script) that outputs to ./export/
  2. Import GLTF file and observe around the armpit area (should only be one action: idle-stretch_hannah-rig)

import-annotated.blend has what I see under the ERROR bone group

Minimum reproduction: min-repo.zip

Expected Behavior

Animations should match

Original:

Original

Exported:

Bad Export

Machine Config

InnPatron commented 5 months ago

Looks like setting export_hierarchy_flatten_bones=True ~fixes the issue~ reduces the magnitude of the issue, but I am not sure why that is the case.

The rig around that area is pretty simple.

julienduroure commented 5 months ago

There are multiple things here:

Using these options solve your issues:

image

Here is repo.blend with reimport of the export, in wire. Seems that everything is ok: image

InnPatron commented 5 months ago

Thanks for the reply!

Looks like my export target (Godot) supports 8 max, but I still have too many influences there. I'll rework the rig and bump up the export maximum instead of allowing unlimited influences.