Thank you for your prompt reply and for sharing your incredible knowledge ![]()
To be honest, I hope @omerization knows better than me for your first part/solution using web workers because I wouldnât have a faen clue how to do it
This is far beyond my reach but an interesting reading.
The second option seems much more achievable. In any case thanks again for your invaluable input and have a great weekend ![]()
Has anybody actually taken a look at the glb file? It doesnât seem to have 12k meshes. Iâm not sure why itâs showing up this way in babylonjs. @omerization If you open this file in blender first then save it you should be seeing around 240 draw calls, which should run way better.
This is a bizarre glb file, and youâll have to confirm nothing is missing, but it doesnât seem like it has even remotely close to 12k parts. I do CAD conversion on a daily basis and have developed blender add-ons to automate reduce of draw calls through a number of techniques depending on our goal with the final file. I plan to post the blender script here soon as well as other (three.js) forums. Iâll try to remember to ping you if youâre interested in using them.
Another nice thing for compressing these (usually giant) STEP â GLB files is draco compression. I suggest using draco on the meshes, once youâre saving your final copy, to reduce the file size substantially. Me and @notmike101 are also releasing a tool called pack3d, which will be able to quickly assist in this process too.
TLDR
This file shouldnât have 12,000 draw calls, it is a bug of some sort. I have seen hundreds of crazy broken glb / fbx files that come from CAD conversions and it is infuriating. Not sure what is causing the issue on this one, but just save the file through blender and it will be fixed. If you want to automate this I suggest writing a small Python script and you can use blender as a command line tool to save the file in order to fix it.
cc @bghgary
LOL, no. At least, not so directly. I actually suggested to do this (and roughly evaluted the number of meshes to be below 300) but at the same time, I assumed that this was a direct and on-the-fly workflow where we just had to deal with the provided export from Opencascade. But then of course, if this is not the case; If somehow it would be possible to make a prep of the file or, even better, instruct the design team on how to make their export, I would urge @omerization to do this (well, in fact, I actually did).
Totally agree and noticed this.
Sounds great. In any case, thanks for assisting @omerization spontaneously and may I add that you reply is both an interesting reading and goes right to the point (my opinion).
I believe having a solid process for this kind of workflow is key.
You can optimize model with gltfpack using default settings which reduces the number of draws from 12k+ to 32. ![]()
gltfpack -i playground-prob.glb -o playground-prob-gltfpack.glb
@bghgary you are the absolute best !!!
Bookmarked as a must have reference. Have a great day, ![]()
Thank you very much. I wanted to try it but I am getting the same import error from BJS whatever model I optimized.
Something like:
Length in header does not match actual data length: 6147384 != 3800930
The one from your OP works. If others donât work, maybe file an issue on GitHub?
Just wanted yours to know that Iâm still following⊠I really want to see the outcome of this.
Meanwhile, have a great day ![]()
Guyss I think I solved this!
I learned that there was an option called âToMergeFacesâ in the gltf writer that I use. And it did what all I wanted.
In the end I think it is doing the same thing as MergeMeshes. But it is not effecting user interface at all.
Thank you everyone tried to help especially @mawa
Glad we could help. See, I just knew there must have been an export setting of some sort.
I still would have liked to see the solution from @bghgary but I bookmarked it anyways so it might just be for some other time. On the other hand, it would be great if you could kindly share a view to the result of your project (just an extract, updating the PG or the project, if possible).
Thanks and have a great day ![]()

