Automatic brotli or gzip compression when exporting .babylon files?


We were able to take a ~37MB .babylon file and compress it down to 5.5MB with the brotli (br) compression scheme. It loads fine; no noticeable latency from cache, and much faster when not cached, of course. Gzip took the same file and turned it into ~7.5MB, so also highly significant bandwidth savings.

Is it possible to add a gzip and/or br export option to the Babylon serializer? And then ideally all of the visual toolchains (Playground, Editor) that make use of the serializer would add the toggle.

1 Like

We are trying not to add any unneeded dependencies to the framework.
I totally agree that it makes sense to zip the .babylon file, as it is essentially a .json file. But as this can be done server-side (and on browser-level during a gzip-enabled network request), I personally don’t see the reason to add compression support.

The playground has jsZip support (and saveAs), so you can do something like this:

Babylon.js Playground (lines 60 to 64)


I totally agree, unfortunately our chosen CDN doesn’t automatically compress files >10MB =/

Thanks for the input.

@RaananW @Deltakosh @Evgeni_Popov do you have a preferred pipeline/workflow for getting 3D assets from DCC like Maya or Blender, to a Babylon scene or GLTF file, to a CDN? And maybe the answer is “host your own CDN server that is more versatile about MIME and compression” which I can work with internally.

We do not. We try to stay away from backend to be honest :slight_smile: We used to work with Netlify in the past though and it was great

1 Like