Which format is the "best"?

There are so many object formats out there

I am a bit confused which one is most efficient to use with babylon.js?

The criteria should be:

  • as little memory consumption as possible
  • fast loading
  • as true to detail as possible

Is there also a format where you can only read out certain parts?

I have seen many examples where loading objects takes an enormous amount of time. I would like to load my objects “on demand”. Do i have to split my objects into individual files? In this case: How do you organize a hierarchical object structure?

1 Like

I would throw my vote in for GLB/GLTF being the best answer these days. Maybe USDZ some day in the future but its barely supported anywhere yet.

  • as little memory consumption as possible
  • fast loading
  • as true to detail as possible

gltf has a lot of extensions: #1 for instance is covered by KTX2 Compressed Textures | Babylon.js Documentation (takes up less video memory) and also #2 because there is less to download for textures.

#2 can also be helped by meshopt compression extension which comes built in support with Babylon (makes the geometry a smaller download)

An excellent tool for generating these from regular glb/gltf files is meshoptimizer/gltf at master · zeux/meshoptimizer · GitHub

PBR support with gltf as well is very good for #3, though its not magical and takes some time to understand and dive in deep Mastering PBR Materials | Babylon.js Documentation before things start looking ‘real’

I have seen many examples where loading objects takes an enormous amount of time. I would like to load my objects “on demand”. Do i have to split my objects into individual files?

This really depends on what you mean. Breaking a mesh into 10 parts won’t help all that much if it’s the same poly/texture/material count. If you mean however that you only want to load the parts you can see currently however, yes that is one answer.

Another is implementing a level of detail system. There are tools and extensions out there like MSFT_lod ( Progressively Load .glTF Files | Babylon.js Documentation ). Support is not good for this though, I would argue you should start simpler and just your create your own progressive lod loading setup to begin.

5 Likes

Here is a nice summary of object formats:

Idea: it would certainly be easier to have a format where you only save the mathematics of the meshes. instead of saving all the facets of a sphere-mesh, you would only save the center point and the radius and, if necessary, the distortion. The facets are calculated after loading. Is there such a format?

Sure, there were more complex formations… but this can be describte by splines!

My motto: if you can not calculate the mesh let the fingers off the keyboard! :smiley:

You can generate meshes from code but they are going to be a collection of vertices, faces, UV coordinates etc once it’s through.

it would certainly be easier to have a format where you only save the mathematics of the meshes

Someone far more knowledgeable than me would have to answer definitively but I believe that is what KTX/MeshOpt/Draco compression attempt to do

2 Likes

So yeah, I’ve been struggling with this one quite a while.

BabylonJS supports glTF with DRACO for mesh compression and the new KTX2(Basisu) for texture compression. This with BabylonJS’s awesome .env hdri is a pretty insane deal if you ask me. It will take quite some time to get the correct export pipeline though.

However, glTF does have a lot of limitations when it comes to exporting everything you see in your favourite 3D software. From post processing to tonemapping, even lights are very limited. This is what USD tries to solve. I do not care that Apple has adopted this format for their limited AR object viewer. But I do think this might be the next standard we’re looking for. How cool would it be to drag an exported file from Blender into the BabylonJS Sandbox, and to see a similar view.

1 Like