# Exported file size

**URL:** <https://forum.babylonjs.com/t/exported-file-size/35740>\
**Category:** Bugs\
**Created:** [November 16, 2022, 7:29am UTC](https://forum.babylonjs.com/t/exported-file-size/35740 "2022-11-16T07:29:08Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dongqui](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dongqui/32/21280_2.png) [@dongqui](https://forum.babylonjs.com/u/dongqui)\
**Post date:** [November 16, 2022, 7:29am UTC](https://forum.babylonjs.com/t/exported-file-size/35740/1 "2022-11-16T07:29:08Z")

</div>

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.

> **[Babylon.js Playground](https://playground.babylonjs.com/#8WB66R)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [November 16, 2022, 9:14am UTC](https://forum.babylonjs.com/t/exported-file-size/35740/2 "2022-11-16T09:14:59Z")

</div>

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

![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/7/d/7d2926b654f0f9c4c7d6c08567b937317bb48184.png)

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

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [November 16, 2022, 4:37pm UTC](https://forum.babylonjs.com/t/exported-file-size/35740/3 "2022-11-16T16:37:46Z")

</div>

Assigned @bghgary on November 16, 2022, 4:37pm UTC



---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [November 16, 2022, 7:27pm UTC](https://forum.babylonjs.com/t/exported-file-size/35740/4 "2022-11-16T19:27:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![JCPalmer](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jcpalmer/32/42_2.png) [@JCPalmer](https://forum.babylonjs.com/u/JCPalmer)\
**Post date:** [November 16, 2022, 8:19pm UTC](https://forum.babylonjs.com/t/exported-file-size/35740/5 "2022-11-16T20:19:46Z")

</div>

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](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/0/f/0fdcd68b2735cc2d421cef43c948cb75b9e380cd.png)

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.

---

<div class="post-metadata">

**Author:** ![dongqui](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dongqui/32/21280_2.png) [@dongqui](https://forum.babylonjs.com/u/dongqui)\
**Post date:** [November 17, 2022, 1:44am UTC](https://forum.babylonjs.com/t/exported-file-size/35740/6 "2022-11-17T01:44:55Z")

</div>

Thanks 🙂

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [November 17, 2022, 9:59pm UTC](https://forum.babylonjs.com/t/exported-file-size/35740/7 "2022-11-17T21:59:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [November 22, 2022, 5:32pm UTC](https://forum.babylonjs.com/t/exported-file-size/35740/8 "2022-11-22T17:32:35Z")

</div>

PR is merged. It will hopefully be deployed soon.

---

<div class="post-metadata">

**Author:** ![bghgary](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bghgary/32/48532_2.png) [@bghgary](https://forum.babylonjs.com/u/bghgary)\
**Post date:** [November 22, 2022, 5:32pm UTC](https://forum.babylonjs.com/t/exported-file-size/35740/9 "2022-11-22T17:32:37Z")

</div>

Unassigned @bghgary on November 22, 2022, 5:32pm UTC


