since csg and mergeMesh need some time for computation I think about improving the speed. My plan is to calculate everything in a web worker but that doesn’t work easily because I can’t pass the meshes to the worker.
Do you have an idea how to solve this?
Here is an example of sending an array of meshes to a worker, merging them and sending the result back to the main thread using Serialization:
Thanks @Raggar. This is exactly what I was looking for.
Unfortunately it didn’t improve the performance of csg. It makes it even slower. The csg process went up from 500ms to 1800ms.
Am I missing something? Or is there another option to improve csg performance?
Making multiple calls to postmessage to webworker is not really efficient.
The transfert is more efficient when you can use ArrayBuffer type data to transfer.
Using serialisation is very time consuming .
Only use one webworker.
I don’t really know your application, but it will be efficient if you can transfer in oneshot all the data to compute in batch . (like a work queue) and then give back results when done (once…).