How to load object data of GLB model?

hello everyone,My English is not very good, I hope you can understand what I mean :smiling_face_with_tear:

I obtained the arraybuffer data from the glb file, and then I parseGlb the binary data. I checked the source code and found out that gltfLoader can load data, and the property uri of the data is in base64 format.

But I obtained binary data through parseglb. If binary data is converted to BASE64, it takes a very long time and the scene will also be displayed normally.


const fileData= await fetch(“…”).arraybuffer(); (80MB)

const mydata = parseGLB(fileData);

//mydata.buffers[0].uri is (binary) data;

mydata.buffers[0].uri = toBase64(mydata.buffers[0].uri);// about 6000ms

let loader = new GLTFLoader(new GLTFFileLoader());


loader.importMeshAsync(“”, scene, null, {json:mydata,bin:null}, “”).then(()=>{



I want to use the attribute “source” instead of the attribute “uri”,what should I do?

I have successfully used this method. Will gltf.json.buffers.length only be 1?
Perhaps there is a more elegant solution?

We recommend that you use SceneLoader instead of GLTFLoader directly. You can pass in either the URL to the asset or the ArrayBufferView if you have downloaded it already. Here’s an example of passing in the URL of the asset and letting it do the download for you:

Does that help?


1 Like