Exported file size

When I export a file through Babylon, the file size becomes doubled.

The origin file size in the playground below is 8mb, but it’s exported as 19mb.

Two materials are using the same base color / normal map and so we add two times the same file in the .glb:


As the two textures have the same internal unique id (so points to the same InternalTexture), we should be able to generate each file a single time.

cc @bghgary

1 Like

I made a fix recently for this, but unfortunately, I did it wrong. I will send a PR to fix it properly soon.

Note that it will still be a bit bigger since it seems the browser’s compression for PNG is not as good as Blender and the images are slightly bigger.


If I can recommend something, it would be to aggressively round (even removing the dot for integers) for certain key sections of data (the big stuff). VertexData & morph data. The bang for the effort buck is kind of huge.

You will need statics vars for the various types inside of that, so that the dev can adjust, if wanted. In Blender, I have these, and only had topic in 8 years where the action was to increase values.
decimal precision

You could be a little more generous, if you wish.

FYI, JSON REQUIRES that leading zeros be present, but not in javascript. In the source code variant, I pulled out the leading 0’s, and the file size dropped an additional 10%. I did that long before I starting meter scaling everything, where more #'s will be less than 1.

Edit: While I thought you were talking about .babylon format, the rest still applies.


Thanks :slight_smile:

PR: Fix glTF export texture dedupe code by bghgary · Pull Request #13263 · BabylonJS/Babylon.js (github.com)


PR is merged. It will hopefully be deployed soon.

1 Like