We are building idiomatic TypeScript bindings for trueform, a production-tested C++ geometry processing library, to bring real-time CSG and mesh processing to Three.js users as a proper npm package.
As a proof of concept we prepared 8 interactive examples by hand-rolling Three.js to trueform interop via Emscripten. Every example runs on meshes up to 500K polygons, with frame-to-frame updates as you drag, scroll, or hover. The algorithms are robust to non-manifold geometry, inconsistent winding, and the kind of mesh artifacts you get from real-world pipelines.
You can try them directly in the browser, on desktop and mobile.
Try them here: trueform.polydera.com/live-examples/boolean
Each example lets you choose mesh complexity (50K, 125K, 250K, 500K polygons) so you can see how the algorithms scale. Meshes contain non-manifold flaps. Rendering is Three.js, geometry is trueform via Emscripten.
The examples
- Mesh Booleans - Drag a mesh around. Union/difference/intersection recomputes every frame. Shows average time per operation.
- Mesh Registration (ICP) - Move and rotate a mesh out of alignment, click Align, watch it snap back in milliseconds.
- Slicing / Isobands - Scroll to move cutting planes through the geometry. Bands recompute as you scroll.
- Cross-Section - Scroll to sweep a cutting plane. Contour extraction updates every frame.
- Shape Index - Hover (or touch on mobile) over the surface. A histogram of local curvature updates based on a configurable radius.
- Free-Form Smoothing - Click and drag on the mesh to smooth vertices. The spatial index updates incrementally so it stays interactive.
- Collision Detection - 25 mesh instances in a grid. Drag one and contact detection runs every frame.
- Closest Points - Drag either mesh. Closest point pair recomputes as you move.
The source code for all examples, the Dockerfile, and the GitHub Actions workflow that compiles WASM and builds the examples page are on GitHub if you want to see how it fits together.
What we are working on
The TypeScript package will expose these algorithms as typed functions. We are designing the API now and have some real questions for people who build with Three.js.
Variable N-gon meshes or triangles only? The C++ library supports dynamic polygon meshes where each face can have a different number of vertices (quads, pentagons, mixed). This involves an offset array, and an ids array. Is this something you would use, or are triangle meshes enough?
Async or sync by default? We will offer both. Should boolean_union(a, b) block and return the result, or return a Promise?
WASM module size. What size would you consider acceptable for a compiled WASM geometry module?
Happy to answer questions about the WASM build, the Three.js integration, or the algorithms.
