BD Planar Grouping
Keep your flat surfaces flat — BD Planar Grouping before you decimate
- mesh
- mesh
- edge_metadata
- status
Decimation has a well-known failure mode with AI-generated meshes: the surfaces are subtly noisy, so a simplification pass treats what should be one flat panel as a hundred tiny angled faces and chews it into mush. If you're trying to get a TRELLIS2 or Pixal3D mesh down to game-friendly poly counts without losing the flat-shaded look, you've probably seen exactly this. BD Planar Grouping is the fix that runs before you decimate: it figures out which faces belong to the same planar region, marks the boundaries between regions as sharp edges, and optionally straightens everything so the flat surfaces survive simplification intact.
The mechanism is straightforward geometry. Connected faces get grouped by how similar their normals are - an angle_threshold (default 15°, lower = more groups) decides when two neighbors are "flat enough" to be one region. Tiny groups below min_group_size (default 10 faces) get merged into a neighbor, so noise doesn't spawn a thousand one-face regions.
The straightening that makes it magical
Where this node earns its keep is straighten_boundaries (off by default). When you turn it on, the node fits a plane to each group, then moves vertices so:
- boundary edges become clean straight lines where two planes intersect, and
- interior vertices (if
project_interioris on, the default) get flattened onto their group's plane.
The result is genuinely geometric - crisp panel lines instead of jagged marching-cube edges. straighten_weight (0–1) controls how far vertices actually move toward those ideal positions; start at 1.0 and back off only if the shape starts to distort.
Two color outputs help you see what happened: color_by_group paints each region a distinct color, and mark_boundary_colors highlights the boundary edges with a contrasting color so the downstream BD Blender Edge Marking node can find them.
The full hard-edge pipeline
The README spells out the intended chain, and it's worth following literally:
BD PlanarGrouping (straighten_boundaries=True)
→ BD Blender Edge Marking (FROM_COLORS_AND_ANGLE)
→ BD Blender Merge Planes (delimit_sharp=True)
→ low-poly mesh with hard edges intact
Planar Grouping marks the boundaries; Edge Marking reads those marks and flags SHARP/SEAM edges; Merge Planes dissolves geometry while respecting the marks. Skip the middle steps and the straightening gets undone by the decimator. This whole path is why the pack calls it "structure-aware" - you're telling the simplifier where the design intent lives instead of letting it guess from noisy geometry.
Install & gotchas
It's part of ComfyUI-BrainDead: ComfyUI Manager → search "BrainDead", or clone the repo into custom_nodes and pip install -r requirements.txt. Nodes land under 🧠BrainDead/Mesh. The pack targets the newer ComfyUI V3 API, so keep ComfyUI updated.
Where people trip: straighten_boundaries is off by default, so if you run it "and nothing happened," that's the first thing to flip. And it's a pre-decimation node - use it before BD Blender Decimate or BD CuMesh Simplify, not after, or the plane-fitting has nothing left to work with. This is also where the pack's Blender nodes matter: several downstream steps (Edge Marking, Merge Planes) run through the bundled Blender, which needs Blender 5.0+ available in lib/. If those fail to import, check that the bundled Blender is intact.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| mesh | TRIMESH | — | |
| angle_threshold | FLOAT | 151–90 | Maximum angle (degrees) between face normals in the same planar group. Lower = more groups, stricter planes. |
| min_group_size | INT | 101–1000 | Minimum faces per group. Smaller groups get merged into nearest neighbor. |
| straighten_boundaries | BOOLEAN | false | Straighten boundary edges by projecting vertices onto plane intersections. Creates clean geometric boundaries. |
| straighten_weight | FLOAT | 1.00–1 | How much to move vertices toward straightened positions (0=none, 1=fully straighten). |
| project_interior | BOOLEAN | true | Also flatten interior vertices onto their group's fitted plane. |
| color_by_group | BOOLEAN | true | Apply distinct colors to each planar group for visualization. |
| mark_boundary_colors | BOOLEAN | true | Mark boundary edges with contrasting vertex colors (for BD_BlenderEdgeMarking). |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| mesh | TRIMESH | — |
| edge_metadata | EDGE_METADATA | — |
| status | STRING | — |