top | item 44161082

(no title)

joeld42 | 9 months ago

It is using ThreeJS for the 3D rendering, with a custom Rust geometry kernel to generate the mesh buffers to render. The editor interface is React based.

discuss

order

Twinklebear|9 months ago

Pretty general question, but what has your approach been for coupling ThreeJS + React w/ a Rust/Wasm kernel for mesh generation? E.g. do you have Wasm own the memory and you give ThreeJS views of the memory to upload to GPU?

joeld42|9 months ago

We don't need to update the scene at once, so when geometry changes we rebuild the buffer and send it over to typescript, and the three.js mesh will own the buffer. By being careful about what needs to be updated, we can keep things interactive.

This is an older blog post but it covers the general idea of it: https://blog.arcol.io/parametric-geometry-engine

prideout|9 months ago

Currently we simply copy a slice of the heap's ArrayBuffer from WASM to JS. In the past we exposed the heap slice directly but it was technically "unsafe" (perhaps because the heap can grow), and doing a copy did not hurt performance in any measurable way.