We are using CSG successfully here to cut meshes but the time it takes to perform these cuts depends greatly on the complexity of the meshes. Given that we can’t control for the mesh complexity (the meshes are coming from an external source), I’m exploring different options for how we can perform the CSG operations.
We have currently offloaded the cutting to our NodeJS server and are using a NullEngine, but the process isn’t any faster, it’s just non-blocking at that point.
What I’d like to do is to offload the CSG cutting to a stand-alone service and not use Javascript for the CSG operation.
So my question to the forum is, what technologies are out there for performing CSG operations that ARENT javascript based and are fast.
You should consider a web worker for that, I offload compute work like retargeting matrices, mesh computation, game minimap, and various assets loading.
Using web workers has been a (literally) game changer for me.
For comparison, a cut that would take 20+ minutes in BabylonJS, takes 23 seconds using JSCAD.
It was relatively easy to integrate the 2 systems as well. I used the STLExport.CreateSTL function to get the methods as STL, turn them into a Buffer that I loaded into JSCAD to perform the operations (boolean subtract and turning that back into an STL).
The “hard” part is getting the resulting cut STL back into BabylonJS. There is no easy “load this ArrayBuffer into a BabylonJS scene” like ThreeJS has. Its either Base64 (which is broken for STLs), or what I ended up doing, uploading the STL to a server a loading it into the scene from the resulting URL.
I do remember when I was making the STL exporter supporting binary was skipped cause screw that noise, so I assume the importer is the same its been so long now I don’t remember though.
update Actually I am mistaken looks like I did add binary support to the serializer at some point. Assumingly because Gary had/has the support for the import working.