Three-bvh-csg with web worker

Hello everyone,
I am using three-bvh-csg library, but due to the complexity of the objects, the subtraction operation takes a very long time. While it is processing, my website becomes unresponsive, and I can’t even display a loading indicator.

I tried using a Web Worker, but the Mesh is too large to be sent via postMessage.

Are there any ways to optimize or improve this process?

Define “too large” :eyes: ? What does the mesh represent? Can it be split into smaller contextual fragments?

(As for the loader - you can show it before the page becomes unresponsive, just make sure to load the model after the loader is already visible. Not that it’d improve the user experience much - frozen website has quite a big chance of crashing the browser or triggering a moral asking the user to force quit the page.)

1 Like

I’ve heard that CSS load indicators run in a separate thread, so they are not blocked when JS is blocking the UI.

2 Likes

Are you using transferable objects to get the model out of the worker? i.e. returning the buffers themselves directly (zero copy) to the main thread, and setting them back into a new empty geometries attributes?

2 Likes