Help with exporting a blender file to .glb

Hi all,

Just quickly, would like to thank everyone for making such an awesome engine for the web!

I have encountered a few problems:

Problem 1
Exporting a blender file to .glb doesn’t load in babylonjs. Funnily enough if I export a .fbx and convert with fbx2gltf - npm it loads but problem 2 persists.

Problem 2
I’ve created one test animation in the blend file. The animation is not playing but they play on the sandbox when I upload the file.

It seems I can’t upload it as I’m a new user, I will attach the .blend file and test glb when I have permissions

Code to import model:

BABYLON.SceneLoader.ImportMesh("Eevee", "/models/Eevee/", "eevee-ani.glb", scene, function (newMeshes, particleSystems, skeletons) {
                const Eevee = newMeshes[0];
                Eevee.position = new BABYLON.Vector3(0, 0, 0);
                scene.beginAnimation(skeletons[0], 0, 71);

This leads me to believe that there is something wrong with the blend file settings. I’ve tried: Struggling with importing animations from Blender into BJS
but that didn’t work. Can anyone help?

Thank you :smile:


Blender: (309.3 KB)
Exported .fbx (from blender) converted to .glb (fbx2gltf): (219.7 KB)
Exported .glb (from blender): (264.4 KB)

Ok, I’ve figured out Problem 1. Exporting the model with the export setting “Selected” set to false worked. But the problem with the animation still persists :frowning:

Pinging @piratejc

1 Like

Hey @thomaswalsh are you using the built in .gltf/.glb exporter in Blender 2.8 or higher? Or are you using the Babylon Blender exporter?

Hi @piratejc, thanks for the speedy reply :slight_smile: Sorry, should have put that in the question. Yes, I’m using the latest blender version (downloaded it 2 days ago) and exporting with the built in .gltf exporter.

Thanks @thomaswalsh.

So the good news is that you’ve already done most of the work to prove that the go-between, between Blender and Babylon, via the built in exporter is working great.

I just recreated the steps that you did by taking your glb file and loading that in the sandbox and it matches the animation I see in your blender file. So from what I’m seeing everything is working correctly. So I’m guessing that your issue is in loading the asset correctly from an external resource.

I usually use github myself, but as long as your file is hosted somewhere that won’t upset the CORS policy, then you should be fine.

Here are two handy resources to check out on the subject:

Hope this helps a bit.
(require loader plugin for .gltf/.glb)

<script src=""></script>
<script src=""></script>