GLTFLoader slow to load GLB file

Hi all,

I’m having an issue with the loading of a GLB file. It’s about 53MB, which I know is fairly big, but it’s literally as small as I can get it after weeks of optimising. It has a lengthy animation timeline, but no textures or materials - I apply all these using JavaScript after the file is loaded.

I can drag the file onto and it loads in under 2 seconds. There’s a slight jitter on the first few frames, but after that the animation plays all the way through, smooth as silk. That’s about what I’d expect since I have 100MB broadband and the file is 53MB.

However, in our production environment, the file is taking around 45 seconds to download. I’m using the onProgress event of GLTFLoader and I can see the download trundles along, uninterrupted and at a fairly constant speed. It’s just incredibly slow! The GLB file is of an animated character, and I’m also downloading a separate GLB file which is an office environment in which to put the character. The office file is 0.7MB and loads so quickly I only see one console.log from the onProgress event of the GLTFLoader.

I know that downloading a 53MB file should take 2 or 3 seconds max on my system, so maybe the GLTFLoader is doing something else as well. Is it parsing the contents of the scene? If so, can I speed this up? Or can I download the file as a blob and then pass that into the GLTFLoader so that it only has to parse it and not parse and download at the same time?

I can’t share the file unfortunately, because it’s for an R&D project for a client.

Thanks so much for any pointers!

The viewer has a big advantage here – it doesn’t download the model over the network, the file is passed directly into memory by the browser.

It’s possible that your web hosting provider does not support the kind of download speeds you expect. A good way to check would be to open the browser’s network tab and inspect the requests. Or are there any other HTTP requests that are slow shown, like downloading Draco or KTX2 decoders?

Also worth a try, if you haven’t yet:

npm install --global @gltf-transform/cli

gltf-transform optimize input.glb output.glb

can the tool be used via npx? i think that would make it much eaiser to establish it as a cli tool. i know i actively avoid globals, i don’t even know why but i never do that.


it works! :pray:

npx @gltf-transform/cli optimize scene.gltf output.glb

@GeorgeP 53 MB is way too much. you do not even need to upload that because there won’t be a single person on this planet with that much patience. > 4mb imo is already large, more than 4-5 is a limit i wouldn’t cross because that already will terminate mobile usage.

i am curious what will happen to your 53mb file if you run the gltf-transform tool over it.

1 Like

@donmccurdy @drcmda thanks both, for taking the time to reply.

I’ve done some more investigation, and it turns out that it really is the size of the file - plain and simple. As a test, I created an image of similar size and added that to my collection of assets for preloading and it took just as long - so it has nothing to do with the GLB file type of the GLTFLoader, it seems. It’s simply that 53MB is a big file.

In this day and age where we’re all streaming UltraHD movies, it seems very odd to me that it can take so long to download a file that realistically is not that big!

Anyhoo, thanks for the pointers guys :pray:.


I think the operative word here is “streaming” whereby no chunk of data being processed is anything near as big as 50MB, if you use three’s loading manager or even simply log when loading is complete you’ll notice that the download time is not actually as great as you think it is, the bigger amount of time would be on first render of a file this size whereby it’s unpacked, loaded to the gpu and shown on screen, processing a 50MB chunk of data is simply always going to take ages…

Is there a progressive/streaming version of GLTF, so that loaders can show intermediate (and incomplete) version of the model – i.e. you see how 3D elements of the model pop up one after another while the huge GLTF is still being transferred…

I do not mean LOD-ding the model, but somehow reorganizing contents into self-sufficient chunks, that the loaders can process on-the-fly.

Thanks for your comment, @forerunrun but I have logged the download time and I preload all the assets long before I create and render my scene. It’s simply the download time I was concerned with. You’re not wrong that rendering the first couple of frames also takes longer than I’d like, but that’s a separate issue!

@PavelBoytchev I doubt there is such a thing, but it wouldn’t help me anyway. I already have separate GLB files for my characters and their environments. At some point in the future, I hope to be able to load selected armature animations from a library, but until I do that, I have all my character animations in the GLB file and that’s part of the reason why it is so large.

This is not a show-stopper for me - what I am building is a virtual assistant that helps users with aspects of a complex financial tool. The assistant loads in the background, independent of the page itself, so it does not slow down the user at all, they just can’t tap the “get help” button for a minute or so. I was hoping to reduce this delay, but I think @drcmda is correct that my file is simply too large for the time being.