Is it possible/worthwhile to offload ExtrudeShape() and MergeMeshes() to web worker?

As the camera pans I’m generating meshes in view using mostly ExtrudeShape() from a set of coordinates, MergeMeshes() and SolidParticleSystems, which tend to make camera panning very choppy, is it possible to offload this to a web worker, and would that be worthwhile?

Pinging @sebavan for his expertise and thoughts.

As Babylon works in worker I guess I could do it in a worker and send back the buffers to the main thread once done ?

1 Like

that would be great :slight_smile: where might i follow updates regarding this?

Sorry I meant You could do it in a worker and share the buffer back to the main thread. I do not think we should do it in standard in babylon but it should be ok to build on top of it.

1 Like

Oh, ok, DIY haha, thank you

Follow-up question, is it possible to instantiate a ‘dummy’ babylon in a web worker (pre 4.1) to be able to use its ExtrudeShape() capabilities? It seems impossible without a canvas, which seems impossible to create without access to the DOM.

You can use offscreen canvas to calculate it in web worker: Offscreen Canvas | Babylon.js Documentation