Jump to content

[solved]What are the best geo compression supported by babylon.js ?


Recommended Posts

Hi guys.

I would like to avoid using a JSON base format in order to reduce assets size to the maximum.

I would like to know what is the best geometry compression supported by babylon.js.

It looks that babylon support gltf. So i guess we can use Open3dgc compression ?


What other options do we have if we want to use LZMA compression ? OpenCTM ? Draco ?




Thanks for your time !



Link to comment
Share on other sites

You should know, by a very wide margin, using geo indexing is the most compact way to represent geometry.  BJS also uses indexing internally on the GPU, and the JSON exporters all attempt to reduce the number of vertices this way.

That said, JSON is a "Zero Pig".  After indexing, you could get about 10% more from a .babylon file, if JSON allowed the omission leading 0's (Javascript is ok with it).  All normals, UV, & matrix weights are values which do not exceed 1.  If I knew who to bitch to about this bush league practice, I would.

Another thing a .babylon file does is to pack matrix indexes 4 in 1.  This limits the number of bones / skeleton to 256, but not really a problem.

From the Blender exporter code base, I have fashioned an inline-geometry javascript exporter, Tower of Babel.  It does not print leading zeros, and along with the JSON exporter, does not print unnecessary signs, decimals, and decimal points.  Beyond that, it inlines 2 small functions to the .js file:

function CONTIG(array, offset, begin, end) {
    for(var i = 0, len = 1 + end - begin; i < len; i++) {
        array[offset + i] = begin + i;
function REPEAT(array, offset, nRepeats, val) {
    for(var i = 0; i < nRepeats; i++) {
        array[offset + i] = val;

The exporter analyses the data, for some of the datatypes, and replaces ascending or repeating values with these functions.  The CONTIG is also heavily used by my implementation of morphing.  You can have different areas of a mesh morph independently  like: face, eyes, left hand, right hand, breasts.  Each area needs a sub-index.  I always define these in ascending order.  It massively improves the representation of morph targets.  Beyond just formating,  a .js file allows you to have mesh subclassing & makes dynamic read ahead possible.

The output  .js file is very readable, with real spaces for indenting.  It is assumed that you would uglify it for distribution.  Finally, there really is not ANY load.  The file is added as a script.

Link to comment
Share on other sites

Thanks a lot for all the great feeback guys ! :)


 so there are already a lot of optimization done.

I work in Maya and i was wondering what would be the safest / most efficient geo format you would recommand to use with babylon.

The problem is that i will use a lot of exotic stuff like bones / morph / vertex color / faces sets etc ...

In theory i first set my focus on .glTF because it looks to be a great idea. But after playing with collada2gltf.exe i am not sure it's the best idea anymore ...

The blender exporter looks better but there is a work in progress feeling in all this .glTF things ... :)


So does json babylon format is a better bet ? what is the most up to date / full exporter i can find to send my maya .FBX into babylon i see several path but not sure which one to take ?

(I would love to avoid using collada .dae cause the Maya exporter is always full of surprise ... so does collada2gltf.exe)

The different horse i can see are those one, but which one is a winner ?

Maya -> FBX -> Blender -> gltf

Maya -> FBX -> Blender -> babylon

Maya -> FBX -> Clara.io -> gltf

Maya -> FBX -> Clara.io -> babylon 

Maya -> FBX -> fbx2babylon tool -> babylon  

Maya -> FBX -> 3dsmax -> babylon 


Intuitively while glTF looks to be a cool concept i'm afraid that the quality of exporter is not bulletproof.

I would put my money on that horse  :


What do you think ?


Thanks again for your Time 

Cheers !






Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...