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 319 forks source link

Animated model import/export creates weird animations #652

Closed jee7 closed 4 years ago

jee7 commented 5 years ago

Describe the bug Importing a GLB file with existing animations creates new and weird animations instead of the existing ones.

To Reproduce

  1. Take the Soldier.glb from the Three.js repo. https://github.com/mrdoob/three.js/blob/dev/examples/models/gltf/Soldier.glb Soldier.zip

  2. Open it in this GLTF Viewer (https://gltf-viewer.donmccurdy.com/), see 4 animations: TPose, Idle, Walk and Run. image

  3. Import it to Blender 2.80 and look at the NLA tracks, there are tons of weirdly named animations instead: image

  4. Export it from Blender (without changing anything) and look at it in GLTF Viewer. There are then those weirdly named animations instead of the prior TPose, Idle, Walk and Run. image

Files Soldier.zip

Version

julienduroure commented 5 years ago

First analysis : There is lots of animation because some animation are multi-object animations. glTF animations can have multiple targets, where blender animation can be only on 1 object (object or armature).

Next analysis steps:

julienduroure commented 5 years ago

Found the root cause:

"skins": [ { "inverseBindMatrices": 424, "joints": [ 3, 4, 5, 6, 7, 8, 10, [.....] 66 ], "name": "vanguard_Mesh", "skeleton": 3 }, { "inverseBindMatrices": 560, "joints": [ 7, 8 ], "name": "vanguard_visor", "skeleton": 3 }

Currently, multiple armature sharing some bones are not supported. Plus, I'm not sure the status of "skeleton" property, that currently is not part of joints list. @donmccurdy : I know that there is a lot of discussion about that, but not sure if something is decided about that ?

julienduroure commented 5 years ago

Probably link to #331 discussion

scurest commented 4 years ago

This is working. The exporter creates the same four animations and they work correctly in the viewer.

bab

jee7 commented 4 years ago

@scurest How did you manage to get this? I tried with Blender 2.82 now and what I'm getting is: 1) The animations shown in the NLA editor still seem weird. image

2) After export the names are correct, yes. image

3) But the animations I'm getting in the viewer are broken. I think all the animations play the Idle animation, but clip it according to the time. For example, the Run animation is 0.7 seconds, so it plays the Idle animation for that time. image

scurest commented 4 years ago

@jee7 You need to use the master branch of this repo. In particular to fix "all animations are clipped versions of Idle" you'll need the fix for #942 which went in, uhhh, 19 hours ago. Might see if its in the Blender nightlies yet.

jee7 commented 4 years ago

Ah, I see. Okay. Will try later with newer Blender versions then. Thanks.

CrezyDud commented 2 years ago

buggd again :(

julienduroure commented 2 years ago

@CrezyDud You are commenting a quite old report already solved. If you have some issue, please open a new ticket with all requested information to be able to understand and reproduce your issue, including a test file.