Export glTF with Animation, Object Turns Smaller in glTF Viewer

Hello, I hope this is the right place to ask this question.

I’m working on this product that are going to be display using AR. I already done the animation that similar to ‘arms’ picking up and drops ‘object’, then the ‘arms’ back to normal position, on loop. I use single armature for the whole ‘arm’ and ‘object’ so i can animate it all in pose mode, the ‘object’ using animated child-of constraint’s influence when being picked and dropped. It looks fine on blender so I applied all modifier then export it to glTF.

But when I import it to model viewer editor/glTF viewer, the whole thing looks soooo tiny. There are errors but I don’t know how to read it. I tried animating the whole thing over and over again focusing on the ‘object’ thinking the amount of modifier might be the cause, i tried not using child-of and manually animate the bones that it attached to, i tried reducing the frames thinking maybe 270 is too much for it to load correctly, but it resulted the same.

I finally tried to hide the ‘object’ and export it, to my surprise it works! The size looks normal and the animation runs, but I need the ‘object’ to be on the scene. Wondering if anyone ever encounter similar problem? Or are there any limitation on animating for glTF? Also, said ‘object’ consists of a few object with different materials, parented to one object for easier grab, i don’t know if that makes any difference or will it work if I use a single meshed object.

Here’s how it looks like on the viewer:
error1

tl;dr — This is a bug in the viewer, and your model is probably fine.

This viewer is built with three.js, and it decides where to put the camera by computing a “bounding box” for the scene. Because of limitations in three.js (https://github.com/mrdoob/three.js/issues/14499, https://github.com/mrdoob/three.js/issues/18334), that bounding box does not factor in changes in size resulting from the animation or the armature. And so if the armature or the animation result in large changes in the scene’s scale (say 1000x or 1/1000x), the camera will be scaled to the wrong bounds and the scene will appear too large or too small.

If you can remove any large changes in scale on the armature or animation, the issue should disappear. But it’s not necessarily a real problem if not — the model should work fine in other software, and you could test in another viewer like https://sandbox.babylonjs.com/ (which uses a different 3D engine) to confirm it’s OK.

2 Likes

Hello! I started this topic and went for a week long holiday, coming back to a solution is such a relief.

Yes, my model works on another viewer that you mention. Turns out my armature is scaled up to 74, when I applied the scale to turn it to 1 it messed up my animation, but that’s for another topic. I ended up re-did the whole animation after applying the scale.

Applying scales before animating will surely avoid this problem in the future. Thank you so much!

1 Like