Hi,
I am facing a long delay while loading the GLB file to the scene in the HTML page. the Glb I have bought from the online 3d model and size is 105 Mb. When kept the same file to my external server. It’s taking more than 5 mins to load.
Can we reduce the loading time of glb files?. Below is my current glb file loading code.
Repro would be best. Sharing the model privately with us would also work if you can get permission from the creator. Barring that, can you get a performance profile?
This model on my machine takes about 2 seconds to load for me. Are you taking the download time into account? Do you want to decrease the size of the model?
It looks like the majority of the time is downloading the model. A 105MB will be slow depending on the network speed.
This GLB is full of PNGs (~45MB) for color textures which can be reduced quite drastically if you convert them to JPGs. The geometry is quite large also (~59MB). You can look at using Draco compression, gltfpack, RapidCompact, or something similar to reduce the size.
HI, I have compressed and the new GLB file is 45 Mb. In the local server, it’s **loading in 2 sec **. In the external server its taking time but not like before. as well i took a new trial hosting space and seen the loading time changed ( if internet connection is good in new server taking 8 secs to load).
As per my experience right hosting is also an important key while loading from web server. Can you please suggest any particular hardware required or and reference of the service provider.
8 seconds is not too bad for a 45 mb file, that’s 6 sec’s transmission time.
The most important things, which you control, are the connection speed of the server & it’s location on the network. Location will determine the number of hops any given client will need to do. Do you have a geographic location where anyone is coming from? Picking a host location which is not hostile is good.
For a global rollout, you might try to use a CDN, which is a bunch of mirror sites. Never done myself.
One thing I see is you have a number of js files coming in. Do you really need both Cannon & Oimo? These files are not big, but why if you are getting them if you are not doing physics? Verify every single js is required.
Also, all your babylon files are coming from your server. This not only increases load on your server, but if the client is far away, the CDN versions of babylon would probably be closer.
does your scene need to be in GLB format? Yes, it compresses it down from gLTF, but it also embeds textures that could be individual downloads/files. Most browsers won’t cache a 45MB file but will happily cache 45 1MB textures. If you expect a lot of repeat visitors GLB might be suboptimal.
Can you apply gzip/brotli or some other compression scheme that the browser can automatically decompress, on top of GLB, to further reduce the file size?
1/ The op says they bought the file, so contained the scope of things to do. Even 45 mb seems wildly too much, given the link they provided. 105 mb just for that seems insane. Think the bigger problem is the overkill probably of both # of triangles & texture sizes. But that’s what happens when you get geometry off of others.
I got some musical instruments from Blendswap. The keyboard was 2.8 million triangles. Fortunately, a lot of it was due to subsurface modifiers, which divided meshes to insane resolutions. Getting rid of them is easy & had an amazing drop to about 160K triangles.
I still had 5 weeks of getting it production ready. In addition to hand removal of un-neccessary geometry, the materials were way too many, and not PBR friendly for export. The keys were also represented as 2 meshes, white & black keys, so it was not playable.
In the end, I got it down to 5,560 triangles, with 4 groups of key instances. Conclusion, arts have very little clue about performance. Getting stuff off them is high quality, and definitely recommended, but plan on spending time editing things down. This squish down, is just a bandaid.
2/ gzip only works on text files I think, but multiple layers of compression tend to no improve things much unless they achieve their results a different way.