godotengine / godot

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

Messed up animation when importing 3D scene DAE #14399

Open dodgyville opened 6 years ago

dodgyville commented 6 years ago

Operating system or device, Godot version, GPU Model and driver (if graphics related): godot 3 (tip), ubuntu

Issue description: When importing a DAE that contains a rigged mesh and animation exported from blender using the better collada exporter, the resulting animation flips around and generally misbehaves.

Here's an example video, blender is running on the right (slowly) and the equivalent import for godot is on the left. https://www.youtube.com/watch?v=fBVpZ2v6Nt4

EDIT: updated link

Zireael07 commented 6 years ago

The link is bad (are you sure it should have "edit"? it leads to creating a new video i.e. prompting to create a channel)

dodgyville commented 6 years ago

Oops, thanks, corrected!

rminderhoud commented 6 years ago

FWIW I am also having a similar issue with rigged meshes and animations except I am not importing a COLLADA file. It would be good to identify whether this is an issue with the COLLADA importer or with the animation system.

karroffel commented 6 years ago

I experience the same thing, but it looks like it's Better Collada's fault.

Comparison Blender - Godot: https://gfycat.com/ScentedConfusedBeardedcollie

Watch the head movement. It's not completely smooth in Blender either but it's much more bumpy in Godot.

I also tried the two glTF exporters for Blender. One exports the meshes incorrectly but has proper animations, the other one has (almost) proper meshes but no animations.

Here you can see that the head movement is a lot smoother like in Blender: https://gfycat.com/FarawayHideousChimpanzee

So the problem seems to actually be in the Better Collada exporter and not Godot.

rminderhoud commented 6 years ago

@karroffel - Do you have a 3rd software you can use to test the penguin that was exported with Better Collada exporter? What about when you re-import the Collada file back into blender?

EDIT: I did my own tests and I can't reproduce it with a random Collada file I found online. The steps I performed:

1) Load the Collada file directly into blender -- Works 2) Load the Collada file directly into godot -- Works 3) Load the Collada file directly into blender and export using better exporter -- Works

wolf.zip

dodgyville commented 6 years ago

I found this nugget while looking at an unrelated 3D program that exports to DAE. This describes the symptoms of my problem but I'm not sure how it applies to exporting.

"COLLADA does not support a native 4x4 matrix transformation format, so we write to the file as a translation or rotation. If you use this to make smoothed animations, this can lead to gimbal lock issues, which appear as sudden 180 flips in playback. You many need to manually edit rotations or smoothing settings."

rminderhoud commented 6 years ago

@dodgyville Interesting find but it looks like the collada export uses a 4x4 matrices?

Writing the bone matrix to collada: https://github.com/godotengine/collada-exporter/blob/master/io_scene_dae/export_dae.py#L1113

Here is how it makes the 4x4 matrix string: https://github.com/godotengine/collada-exporter/blob/master/io_scene_dae/export_dae.py#L61

rminderhoud commented 6 years ago

@dodgyville are you able to share the file you've been working with?

dodgyville commented 6 years ago

It's a pretty large file (256mb - several minutes of animation), I'll see if I can shrink it.

I've just noticed that if I bake the animation using the Pose data then the import to godot plays smoothly but the character does not move around.

rminderhoud commented 6 years ago

So you are now able to import the skeleton (armature) into godot correctly with animations but the mesh does not move? Was the issue always only with the mesh or was the armature previously "spinning" also?

dodgyville commented 6 years ago

The bone animation deforms the mesh correctly and there is no flipping but the character does not move around the scene and is instead pinned in place. So close! Video

dodgyville commented 6 years ago

OK, update on this. In Blender, changing the rotation type for objects (3D View > Properties region (N) > Transform panel > Rotation) from XYZ Euler to Quaternion (WXYZ) helps a lot when exporting as DAE. There's now an issue with the object drifting around but it's closer than ever.

glaforte commented 5 years ago

@dodgyville Hello! Sorry to revive this old issue. Any chance you could try to reproduce this issue with the 3.0.6 release or the 3.1/master? Alternatively, could you please provide us with the Blender data files? Thank you 😄

artellblender commented 5 years ago

Hello, while porting the collada exporter code to 2.8 i've found out that the armature rest pose are not exported, instead the first frame is set as the rest pose which lead to incorrect results. Not sure if this is the same as this bug report, but here it is: https://github.com/godotengine/collada-exporter/issues/99

artellblender commented 5 years ago

I've fixed it in a patch along the 2.8 update: https://github.com/godotengine/collada-exporter/pull/100

KoBeWi commented 4 years ago

Can anyone still reproduce this bug in Godot 3.2.1 or any later release (e.g. 3.2.2-beta4)?

If yes, please ensure that an up-to-date Minimal Reproduction Project (MRP) is included in this report (a MRP is a zipped Godot project with the minimal elements necessary to reliably trigger the bug). You can upload ZIP files in an issue comment with a drag and drop.

hignatious commented 4 years ago

@KoBeWi Hi I have a small project that might be exhibiting the behaviour described here.

Video

collada-animation-bug.zip

Not sure if this is exactly the same bug as described above but I found this thread while trying to find a solution so I thought I might as well post what I have.

aaronfranke commented 2 months ago

Can anyone reproduce this issue in a Godot 4.x version, such as Godot 4.3?

Does this issue occur if you export a glTF (.glb or .gltf) file from Blender instead of exporting a Collada (.dae) file? The Collada/DAE importer is not being actively maintained anymore, in favor of glTF.