Size of the "CSG meshes"

Hi evryone,

I have a question about the size of the meshes resulting of a CSG Transformation.

Here’s the mesh before transformation :


Its size alone is 177ko (GTLF format)

I want to make a structure with 4 of these profiles. Here it is :

The size of the scene saved in a .babylon file is now 13527 ko.

I want to precise that the empty scene (only axes, sky, ground…) is 743 ko and the size does not change if the edges are rendered or not.

So i assume that the size of the “CSG structure” is 12784 ko (13527 - 743).

Why is it so big because the mesh is only 177 ko ? Is there a way to reduce it ?

Thanks for your answers.


Could you provide a PG example?
Otherwise it is hard to tell what is going on.
The size difference also my depend on format used. What is happening when you save the scene to GLB?

I can’t save my scene to GLB.

here’s the error

If I make the same structure with “L profiles” made with BABYLON.MeshBuilder.ExtrudePolygon function, the size is only 840 ko


My conclusion is that the CSG Transformation with gltf files is very loud.

I’m not sure to be able to provide a PG example because i have a lot of classes. I will try anyway.

Here’s the playground (sorry for the number of lines). The classes are at the top and the function at the bottom.

typeprofil = 1 → size of the babylon file = 102 ko
typeprofil = 2 → size of the babylon file = 12794 ko

if you want to change the value of typeprofil, go to the line 706

Hope it will help you to find an answer.

PS : I manage to export my scene to GLB and BABYLON formats with the playground. The error must be elsewhere…

Anybody ???

Thanks in advance,


A shorter playground would be helpful :smiley:

Here it is :slight_smile:

I think I cannot make it shorter…

It’s still a bit too complex :sweat_smile: but in general, it seems that .babylon files will be bigger than .glb files… I tried with the base playground scene:
A default CSG example: ( Babylon.js Playground (
And a more complex example: ( Advanced instanced buffer control | Babylon.js Playground (

I would also add that there is actually almost no difference in size when you use gzip compression on your server.

1 Like

Ok, I made a new shorter PG with only one profile :

The size of the scene is now 3513 ko when exporting in . babylon format but my mesh is only 177 ko before the cut.

I don’t understand why the size is so big…