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.48k stars 316 forks source link

Export to GLB file changes the scale of bones and mesh #1062

Open dhaval85 opened 4 years ago

dhaval85 commented 4 years ago

Describe the bug After importing FBX file with bones and exporting it as GLB file makes bones shrink. See the attached FBX file as an example.

To Reproduce Steps to reproduce the behavior:

  1. Create a new Blender project.
  2. Import the attached FBX file by going to File->Import->FBX
  3. Now export the blender project as GLB file by going to File->Export->GLB
  4. Create a new Blender project.
  5. Import the exported GLB file and see the bones and everything is shrink.

Expected behavior GLB file should keep the size of bones and mesh as it is.

Screenshots

Screenshot 2020-05-07 at 10 15 17 PM

.blend file/ .gltf

Canonical_Face_Mesh.zip

Version

Additional context NA

donmccurdy commented 4 years ago

See https://blender.stackexchange.com/a/109976/43930 for some context here. In glTF, and in many other programs, bones are considered "joints" that do not have a length except the distance to the next joint. Since the bones above are leaves (not connected to anything) there is no persistent concept of their length outside of Blender.

donmccurdy commented 4 years ago

If your use case requires a stable bone length for something, consider adding an additional bone to the end of each.

dhaval85 commented 4 years ago

@donmccurdy Thank you for the reply. I see your point. I see the bone distance and everything seems correct. It's the mesh which is getting bigger. I am setting up Length scale to centimetre in my project. But I guess the mesh is bigger. Do you think I can keep the scale as it is? I am applying all the transformations before exporting to GLB.

I cannot add more bones because this is going to be used for Android ARCore Face Augmentation asset.

Thank you!

donmccurdy commented 4 years ago

But I guess the mesh is bigger. Do you think I can keep the scale as it is? I am applying all the transformations before exporting to GLB.

Could you share a .blend in the final state before you would export? My guess is that the scale change is coming from something in the FBX file, it's pretty common to get a 100x multiplier with FBX. Note that glTF's units are in meters, perhaps your scene settings need to match that?

dhaval85 commented 4 years ago

Here: test.blend.zip

You are right. My scene settings are centimetre. Because ARCore suggest to have units in centimetre. See here.

Thank you very much. I guess it also has problem with the rotation too. Not sure if they are related.

julienduroure commented 4 years ago

Hello,

For units, cf #365

dhaval85 commented 4 years ago

@julienduroure Ahh I see. Thank you! I guess I will wait for that enhancement. Till then I will try to scale it down in my code and see if that works.

singhsaabh92 commented 1 year ago

@dhaval85 I'm also facing the same problem. You found any solution for this?

dhaval85 commented 1 year ago

@dhaval85 I'm also facing the same problem. You found any solution for this?

Nope. I also abandoned my project. So never tried to make this work. But as suggested make sure the units are same. In case it doesn't work then you will have to scale it down after you import it.