Can't use append .glb file


I’m using for the following example to add a model to the scene.

The basic cod is

BABYLON.SceneLoader.Append("", “data:”+ gltf, scene, function () {
scene.createDefaultCamera(true, true, true);

I’m doing similar but using a .glb format.

Is .glb supported?

This is the start of my error.

BJS - [18:29:48]: Unable to load from data:glTF

Any help would be awesome

Yes, .glb is supported, but doing it in same way than the linked PG can be a bit complicated as .glb is binary.

You should link the PG which raises the error so that we can debug it.

1 Like

We have an issue filed to support loading a glb from base64 or arraybuffer directly: Add support for loading glb from a base64-encoded string or arraybuffer · Issue #5579 · BabylonJS/Babylon.js · GitHub.

For base64, you can do something like this for now:

Just realize that base64 is not efficient for dealing with glb assets. Array buffers can be done similarly.

1 Like