Hi,
I’m using rhino3dm.js (the JavaScript/WebAssembly build of openNURBS) in a browser-based 3D viewer to export large meshes to .3dm. I’m hitting the 32-bit WebAssembly linear memory ceiling (~2 GB addressable, ~4 GB hard cap) when serializing large models.
Concrete repro:
- Input: ~28.6M vertices / 9.5M triangles across 54 meshes (single file → GLB ~670 MB on disk).
- Payload handed to the worker: ~327 MB of Float32Array vertex positions (normals stripped, Rhino recomputes them).
- Pipeline: meshes are pre-merged on the JS side, then for each group I call new rhino.Mesh(), mesh.vertices().add(…), mesh.faces().addFace(…), mesh.compact(), mesh.normals().computeNormals(), append to File3dm, then doc.toByteArray().
- Result: after roughly 20–25 groups, verts.add() starts silently failing (vertex count stops incrementing), and the final doc.toByteArray() triggers Aborted(). Build with -sASSERTIONS for more info. — the classic Emscripten OOM abort when the WASM heap can’t grow further.
- Tested on rhino3dm@8.4.0 and @7.15.0 , Chromium-based browser, dedicated Web Worker, INITIAL_MEMORY left at default and ALLOW_MEMORY_GROWTH implicitly on. Same outcome.
What I’d like to ask:
- Are there plans to publish a WASM64 / -sMEMORY64=1 build of rhino3dm.js so the linear memory can exceed the 4 GB cap on browsers that support the memory64 proposal (Chrome/Edge behind a flag today, shipping more broadly soon)?
- If not, would it be possible to expose a bulk/typed-array vertex and face ingestion API (e.g. mesh.vertices().setFromFloat32Array(buffer) / mesh.faces().setFromUint32Array(buffer)) to avoid the per-vertex/per-face JS↔WASM call overhead and the intermediate allocations that inflate heap usage?
- Any recommended EMSCRIPTEN_* build flags or Module instantiation options (e.g. higher INITIAL_MEMORY, MAXIMUM_MEMORY=4GB) you’d suggest in the meantime?
For now my workaround is to fall back to glTF/GLB export for models above ~15M vertices, but native .3dm output is what I actually want.
Happy to share more info if useful.
Thanks!