godotengine / godot

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

Broken Blender -> GLTF2 -> Godot pipeline #15802

Closed brainsick closed 6 years ago

brainsick commented 6 years ago

Godot version: Godot 3.0 RC1

OS/device including version: Ubuntu 17.10 x64, AMD Radeon R9 Fury

Issue description: I'm trying to import phoenix bird into Godot.

I first import the FBX file into Blender. I fix up the textures and edit the animation to end on the last keyframe. I play the animation to test it; Blender success! .blend file included (you may need to add a lamp back in).

screenshot from 2018-01-17 00-25-50

I delete the default lamp and camera and export it via the Khronos GLTF 2 Exporter.

- Embed buffers - Embed images - Strip delimiters - Export selected only + Export all layers - Export extras + Convert Z to Y up - Apply modifiers - Force maximum indices + Export texture coordinates + Export normals + Export tangents + Export colors + Export materials - Export cameras + Export animations + Export within playback range + Keyframes start with 0 - Force sample animations + Export skinning - Bake skinning constraints + Export morphing + Export morphing normals + Export morphing tangents - Experimental (none)

Godot imports the GLTF 2 file. I double click the fly.gltf file and Open Anyway the scene for a preview.

screenshot from 2018-01-17 00-46-03

The scale appears to be way off. I had this same issue with the GLTF files generated by SketchFab.

Selecting the AnimationPlayer and pressing "Play selected animation from start. (Shift+D)" causes what is visible to inexplicably rotate.

No mesh is rendered. Nothing I do with the materials makes any difference until I play the animation and then I end up with this:

screenshot from 2018-01-17 01-01-57

Steps to reproduce:

Minimal reproduction project:

PhoenixAltGLTFImport.zip

fire commented 6 years ago

Issue is very similiar to my issue. https://github.com/godotengine/godot/issues/15181

capnm commented 6 years ago

Yep, the gltf2 importer is currently in a sorry state: https://github.com/godotengine/godot/issues/14725 https://github.com/godotengine/godot/issues/14636 https://github.com/godotengine/godot/issues/15715 https://github.com/godotengine/godot/issues/15798

peek 2018-01-17 12-28

reduz commented 6 years ago

Importing geometry generally works fine, skeletal animation is broken at the moment. regarding scale, both Godot and GLTF use the same coordinate system and unit scale, so if scale does not look right it's a problem of the model.

capnm commented 6 years ago

I didn't figured why, but sometimes some spatial nodes get a completely wrong transformation … If you correct this manually in the editor (the last man), even the animation will be correct.

reduz commented 6 years ago

didn't figured why, but sometimes some spatial nodes get a completely wrong transformation …

I have seen this in a few scenes I got from sketchfab but, as I mentioned, I'm not sure why it might happen as Godot does no unit or axis conversion at all, given it uses the same exact as gltf

brainsick commented 6 years ago

There is similarity with #15181 in that it mentions scale. The other issues appear to be different situations though.

I thought GLTF was the "approved" 3d asset pipeline, so I was surprised to find these issues and thought I should report them.

capnm commented 6 years ago

blender -> gltf -> godot / gltf-viewer

bildschirmfoto vom 2018-01-17 14-00-37

bildschirmfoto vom 2018-01-17 14-12-15

bildschirmfoto vom 2018-01-17 14-12-57

bildschirmfoto vom 2018-01-17 14-23-40

blender-exp2.zip

reduz commented 6 years ago

Nope, "official" is still Collada until gltf importer is more tested and stable. It will hopefully become less buggy in 3.1

On Jan 17, 2018 10:25 AM, "Martin Capitanio" notifications@github.com wrote:

blender -> gltf -> godot / gltf-viewer

[image: bildschirmfoto vom 2018-01-17 14-00-37] https://user-images.githubusercontent.com/4047289/35044487-d0d6e7c8-fb90-11e7-83d8-53caafa672df.png

[image: bildschirmfoto vom 2018-01-17 14-12-15] https://user-images.githubusercontent.com/4047289/35044500-e01b50ac-fb90-11e7-90e1-24dd1c56b1d7.png

[image: bildschirmfoto vom 2018-01-17 14-12-57] https://user-images.githubusercontent.com/4047289/35044512-ef7f184e-fb90-11e7-9716-921f2dd27c96.png

[image: bildschirmfoto vom 2018-01-17 14-23-40] https://user-images.githubusercontent.com/4047289/35044859-2af13ece-fb92-11e7-9e6a-472af926015f.png

blender-exp2.zip https://github.com/godotengine/godot/files/1639085/blender-exp2.zip

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/godotengine/godot/issues/15802#issuecomment-358303300, or mute the thread https://github.com/notifications/unsubscribe-auth/AF-Z2xfYR_-2-5GxQQMHGpCgX3ze7wLMks5tLfTPgaJpZM4Rg5Va .

reduz commented 6 years ago

In any case, if you guys can make simple scenes (very little amount of geometry and bones) that break, that will make my job of fixing the importer easier

On Jan 17, 2018 10:37 AM, "Juan Linietsky" reduzio@gmail.com wrote:

Nope, "official" is still Collada until gltf importer is more tested and stable. It will hopefully become less buggy in 3.1

On Jan 17, 2018 10:25 AM, "Martin Capitanio" notifications@github.com wrote:

blender -> gltf -> godot / gltf-viewer

[image: bildschirmfoto vom 2018-01-17 14-00-37] https://user-images.githubusercontent.com/4047289/35044487-d0d6e7c8-fb90-11e7-83d8-53caafa672df.png

[image: bildschirmfoto vom 2018-01-17 14-12-15] https://user-images.githubusercontent.com/4047289/35044500-e01b50ac-fb90-11e7-90e1-24dd1c56b1d7.png

[image: bildschirmfoto vom 2018-01-17 14-12-57] https://user-images.githubusercontent.com/4047289/35044512-ef7f184e-fb90-11e7-9716-921f2dd27c96.png

[image: bildschirmfoto vom 2018-01-17 14-23-40] https://user-images.githubusercontent.com/4047289/35044859-2af13ece-fb92-11e7-9e6a-472af926015f.png

blender-exp2.zip https://github.com/godotengine/godot/files/1639085/blender-exp2.zip

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/godotengine/godot/issues/15802#issuecomment-358303300, or mute the thread https://github.com/notifications/unsubscribe-auth/AF-Z2xfYR_-2-5GxQQMHGpCgX3ze7wLMks5tLfTPgaJpZM4Rg5Va .

brainsick commented 6 years ago

Okay, I have issues noted for the Better Collada exporter too. I haven't submitted them because I wasn't sure if it was still supported.

brainsick commented 6 years ago

I can do simpler. This is so simple that I no longer recognize it as the original reported issue though.

https://youtu.be/Sh7nih_8a1g BlenderGLTFGodotCube.zip

If it matters, I built a spin cube from the ground up and it worked as expected. I discarded that and tore the spin cube down from my crush cube example; meaning that I deleted the Armature/poses/bones (all data blocks that I could find) and then added the spin animation. Then an unexpected scaling issue manifests. Blender and glTF Viewer seem fine though. blend file included.

The actual size of the cube is fine, I'm not surprised that it's bigger than the others. I'm surprised that the scale is being animated. Hovering over the keyframes in Godot confirms that scale is being animated for some reason.

As a convenience, I keyframe'd LocRotScale in Blender. But scale was never initialized and doesn't change so I'm expecting a noop or at least an unchanging value.

screenshot from 2018-01-17 14-34-45

Indeed, when I change to keyframe just Rotation in Blender, Godot behaves as expected.

screenshot from 2018-01-17 15-09-08

brainsick commented 6 years ago

Another animation quirk in Godot. This time using 03 all animations. The parent sphere does not move fluidly and the tetrahedron has scale issues in its animation.

image

Just an amusing observation, but Blender rotates counter to Godot and glTF Viewer. This could be an export bug or I did something goofy in the export settings.

https://youtu.be/quzdp0nYlDI

capnm commented 6 years ago

Just an amusing observation, but Blender rotates counter to Godot and glTF Viewer. This could be an export bug or I did something goofy in the export settings.

That's an inherent problem of the Euler rotation from 0° to 0°. If you change the endpoint to 360°, it works as expected.

brainsick commented 6 years ago

That's an inherent problem of the Euler rotation from 0° to 0°. If you change the second endpoint to 360°, it works as expected.

I naively used 0° to 360° in my own attempt which didn't manifest this behavior. So, today I learned! Thanks. :+1:

brainsick commented 6 years ago

Another animation quirk in Godot. Using 01 morphed cube. The cube does not animate at all in Godot. This one uses something called shape keys.

Note that this does not animate in glTF Viewer either. So, this might this be an issue with the exporter.

fire commented 6 years ago

https://github.com/googlevr/poly-toolkit-unreal/blob/master/PolyToolkit/Source/PolyToolkit/Private/Gltf2Importer.cpp Has an Apache 2 licensed gltf2 importer. Perhaps it is good to check if Google did things differently.

fire commented 6 years ago

Ping! anyone still working on this?

RandomShaper commented 6 years ago

I'm investigating skeleton issues. At this point I have a solid clue to follow.

fire commented 6 years ago

Fixes from 5b70ad9d34d2777e3abd0a13118442eb132aff70

First scene is the same as https://github.com/godotengine/godot/issues/15798

godot windows opt tools 64_2018-08-06_23-18-15

Second scene is Cesium man.

godot windows opt tools 64_2018-08-06_23-27-58

https://github.com/godotengine/godot/issues/15802#issuecomment-359271606

01_morphed_cube is still not supported.

akien-mga commented 6 years ago

Closing as fixed by 5b70ad9, if there are some cases which still don't work, please open specific issues for them.