trimesh-boolean 0.5.12: just got a lot lighter
The booleans were always correct. They were just too fat to carry around.
That's the thing 0.5.12 fixes. The library's native output is triangle soup, where every triangle hauls its own three vertices with it. Dead simple to consume, and fine when you're cutting a few thousand triangles. The problem shows up when a terrain surface meets a solid and you get a few million triangles out the other side. In a soup, every shared vertex is stored five to ten times over. That's a lot of the same point, written down again and again, clogging up memory.
So there's now an indexed twin.
One shared vertex pool, and every triangle is just three integers pointing into it.
Three things fall out of that.
Memory.
A big result drops to roughly a fifth or a tenth of its soup weight. Same geometry, far less of it repeated.
The seam welds itself (mostly).
The pool is shared across all four groups at once, inside and outside of both meshes, so the join between an inside piece and its outside piece lines up on the same vertices. No second dedupe pass to stitch it back together.
It's GPU-ready.
There's a helper that flattens the whole lot into typed arrays: one positions buffer, and a compact index buffer per group all pointing at it. That's a straight BufferGeometry upload in Three.js. This is the part that matters for Kirra, where the result has to live in a browser tab and get drawn without setting the laptop on fire.
None of this breaks anything. The soup output is untouched. You opt in when you want it:
var bms = bmsBooleanOp(meshA, meshB, 'subtract', { indexed: true });Or run indexGroups on soup you already have. If soup was working for you, keep using soup.
One honest note. The soup-free decompose uses shared-vertex connectivity, which is coarser than the shared-edge version. On a clean welded result the two agree. On meshes with genuine vertex-only touches, the indexed path gives you fewer, bigger components. Worth knowing before you lean on it.
For anyone who missed the pitch: trimesh-boolean is still the only npm package that does booleans on open surfaces, the terrain, DTMs and partial shells the others refuse because they demand closed watertight solids. The indexed output is what makes those results usable at the scale real mining meshes actually reach.
Thanks to everyone, It keeps the thing moving.
https://www.npmjs.com/package/trimesh-boolean
npm i trimesh-boolean