Nodes/BrainDead Nodes/BD Planar Grouping
ComfyUI Node

BD Planar Grouping

Keep your flat surfaces flat — BD Planar Grouping before you decimate

By BizaNator·Created 8 months ago·Updated 3 days ago· 15
BD Planar Grouping
  • mesh
  • mesh
  • edge_metadata
  • status
angle_threshold15
min_group_size10
straighten_boundariesfalse
straighten_weight1.0
project_interiortrue
color_by_grouptrue
mark_boundary_colorstrue

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_interior is 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.

Category🧠BrainDead/Mesh

Inputs (8)

NameTypeDefaultDescription
meshTRIMESH
angle_thresholdFLOAT151–90Maximum angle (degrees) between face normals in the same planar group. Lower = more groups, stricter planes.
min_group_sizeINT101–1000Minimum faces per group. Smaller groups get merged into nearest neighbor.
straighten_boundariesBOOLEANfalseStraighten boundary edges by projecting vertices onto plane intersections. Creates clean geometric boundaries.
straighten_weightFLOAT1.00–1How much to move vertices toward straightened positions (0=none, 1=fully straighten).
project_interiorBOOLEANtrueAlso flatten interior vertices onto their group's fitted plane.
color_by_groupBOOLEANtrueApply distinct colors to each planar group for visualization.
mark_boundary_colorsBOOLEANtrueMark boundary edges with contrasting vertex colors (for BD_BlenderEdgeMarking).

Outputs (3)

NameTypeDescription
meshTRIMESH
edge_metadataEDGE_METADATA
statusSTRING