
WFC Mesh Slicer for Blender
A single-file Blender 4.0+ add-on that turns a mesh into Wave Function Collapse–ready modules: slices into cube-aligned cells, analyzes 6-axis neighbor connections, exports to JSON, and reconstructs from JSON.
The add-on adds a WFC Mesh Slicer panel to the 3D Viewport sidebar with four sections: Basic Grid Slicing (N×N×N cells via Intersect/Bisect/Boolean), Snapped Grid Slicing (explicit X/Y/Z cell size, with blocking, modal, optimized-modal, and clearMesh variants), Connection Analysis (walks grid indices, computes 6-axis neighbors, writes wfc_connections_*.json), and Reconstruction (places duplicates from JSON, optional join + auto-solidify).
The snapped-grid operators are modal with an event timer so the UI stays responsive and ESC cancels mid-grid; the optimized variant caches the source mesh as a world-space BMesh and builds a spatial hash for early face-culling. Every boolean apply site catches RuntimeError and retries with the FAST solver.
A standalone Solidify Active Mesh utility implements a 6-pass hybrid interior-face removal pipeline combining Blender's select_interior_faces, a boolean-hack oversized-cube intersect, BMesh duplicate-face dedup, a conservative BVH dual-ray internal-face test, and hole filling — deliberately conservative (refuses to delete >60% of faces) to avoid deleting the outer shell.
Key features
- Basic grid slicing (N×N×N) via Intersect / Bisect / Boolean with optional guide cubes.
- Snapped grid slicing with explicit X/Y/Z cell size — modal, optimized, blocking, and clearMesh variants.
- 6-axis neighbor connection analysis → wfc_connections_*.json export.
- Reconstruction from JSON: place duplicates, optional join, optional auto-solidify.
- 6-pass hybrid solidification (select_interior_faces + boolean-hack + BMesh dedup + BVH dual-ray + hole fill).
- EXACT-then-FAST boolean solver fallback; spatial-hash early-cull for empty cells.
- Modal operators with event timer + ESC cancel; defensive by-name object lookup.