File download size issue

test | Babylon.js Playground
I need to download a mesh with low size by compromising quality. When i tried to download it , it reduces the quality but size remains same. Any help how to reduce the size of the downloaded file as well.(As this downloaded file is taking single mesh as compared to the whole model). Thanks

pinging @RaananW who worked on the mesh simplification

The simplifier uses LOD to add meshes on top of the origin mesh. If you are downloading the mesh itself, it will still download the same data.

If you want to reference the LOD mesh, use (for example) the getLODLevelAtDistance with the correct distance. this will give you the LOD mesh (the simplified one) and not the original one. Downloading it will result in a smaller file size

1 Like

test | Babylon.js Playground … Downloaded file size remains same in this case. I’m using marble model in this case, It’s original size is 30 kb and it has 7 meshes while simplifying only 1 mesh got add into this array and it’s size changes from 30kb to around 380 kb.

There is nothing being simplified in the given scene. The array you are providing has no object whatsoever. Your logs also state that - the object returned from the getLODLevelAtDistance function is null.

I don’t quite get what’s happening in the scene. The playground also complains about the lack of delay-load state since there is no camera assigned.

I am not saying you are wrong, i am just saying it’s impossible for me to check that :slight_smile:
Please get the scene to work correctly, with the right logs in place and let me know what’s the expected behavior is.

On a side note - Babylon’s simplification was implemented for real-time LOD assignments. There are much better simplification tools, some of them also take textures into account (which the babylon implementation doesn’t). If you are trying to use babylon as a simplification tool to download and use somewhere else, i would recommend to find some native application that does that.

Just uncomment any of these distance and quality and put that distance value in getLODLevelAtDistance. Marble quality will decrease by doing so. and file will download as well.
(On the other end I imported skull model and implemented this technique, Skull Model size is 4 mb but when I used your method getLODLevelAtDistance , model simplfied and file size reduces to some kB).
Issue remains same when I imported any other model having no. of meshes more than one, I’ll provide you another link for this detail.

I really dont want to download it, but I have to check for the file size that is why I am downloading it.

test | Babylon.js Playground

Looks like it is working, I am not sure to fully get your issue here ? Also I would recommend to use external tools for simplifications as @RaananW was saying as our approach is the most simplistic ever fitting for real time but not necessarily the best if you want to pre bake them.

@hassanmujtabame is actually trying to have different files (in terms of size) by reducing the meshes of the model. If I’m not wrong.

Hi @hassanmujtabame,

sorry for a very late reply.

t does work now, but i am still not sure what you are trying to achieve :slight_smile: You are serializing the mesh to the .babylon file format but are naming it .gltf, which i guess is the source of the confusion.