Grid Three.js in WebWorker

I am trying to offload as many Trjs calculations as possible to a web worker. This seems relatively doable when it just wants the worker to create the geometry. However, I still need to create a significant number of grids, which implies a hefty cycle in the main thread.

Is it possible to offload the grid to a web worker and just add the main stream to the scene (when it's ready)?

The idea would be for the worker to create an array of cells based on some data and pass them to the main thread.

Thank you very much

+5
source share
1 answer

I am currently ready to solve this problem in one of my projects. If you have not started yours, I would suggest taking a look at https://github.com/kripken/webgl-worker first . There are two examples (one simple, one more complex) that can help get you started.

I will talk about this later with more details on how to integrate wegl-worker with a tag. js, which may require more configuration than a simple webgl / worker implementation.

0
source

Source: https://habr.com/ru/post/1242722/


All Articles