๐Ÿ™ˆ OffscreenCanvas

The OffscreenCanvas API (opens in a new tab) lets you offload the rendering of a canvas to a web worker. This is useful if you want to avoid blocking the main thread and causing jank in your canvas when performing heavy computations (demo (opens in a new tab)).

Here is a repository (opens in a new tab) showing how to set it up with Three.js and React Three Fiber (demo (opens in a new tab)).

OffscreenCanvas is supported by Chrome and Firefox, and will be supported in Safari 16.4 (Can I Use (opens in a new tab)).

react-three-offscreen (opens in a new tab) (repo (opens in a new tab)) โ€“ Offscreen worker canvas for R3F