Dev.to
7/14/2026

Diagnosing a Broken STL File: Union-Find, Boundary Loops, and SDF Voxel Rebuilds
Short summary
A technical deep-dive into diagnosing and repairing broken 3D mesh files, particularly common with AI-generated meshes and phone LiDAR scans. Covers using edge-face count maps to detect boundary edges and non-manifold geometry, union-find for shell detection as an AI-slop filter, vertex welding with scale-relative tolerance, and a client-side repair pipeline built with three.js. Includes code snippets for the core algorithms.
- •Edge-face count maps detect holes (boundary edges) and non-manifold geometry in meshes
- •Union-find shell detection doubles as an AI-slop detector for floating mesh debris
- •Vertex welding tolerance must scale with bounding-box diagonal, not use a fixed epsilon
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



