Nodes/Avatar Graph/Mesh Face Make Planar
ComfyUI Node

Mesh Face Make Planar

Flattening warped faces back into a plane in Avatar Graph

By avatechai·Created 3 years ago·Updated 2 years ago· 264
Mesh Face Make Planar
  • BPY_OBJ
  • BPY_OBJ
factor1.00
repeat1

Faces that should be flat sometimes aren't - after a remesh, a decimate pass, or generation from a noisy source, a quad that ought to sit dead flat can end up slightly warped, with its four corners not quite coplanar. Mesh Face Make Planar nudges selected faces back toward flat, blending each one toward its own best-fit plane.

How it works

This wraps Blender's mesh.face_make_planar operator. For each selected face, it computes the plane that best fits that face's vertices, then moves the vertices toward that plane by a controllable amount rather than snapping instantly - which matters on a connected mesh, since a face's corners are usually shared with neighboring faces, and a small, blended adjustment is less likely to introduce new distortion elsewhere than an aggressive one-shot flatten would.

The inputs and outputs that matter

  • BPY_OBJ - the mesh with the faces you want flattened already selected.
  • factor (default 1, range -10 to 10) - how strongly to pull toward planar. 1 moves fully to the best-fit plane; lower values apply a partial correction; negative values push away from planar instead, which is occasionally useful if a face is already flat and you want to intentionally introduce a bit of curvature.
  • repeat (default 1, range 1–10000) - how many times to run the pass. On faces connected to a lot of other geometry, one pass doesn't always fully converge, since flattening one face can slightly un-flatten its neighbors; repeating the operation lets it settle closer to a stable, genuinely flat result.

Output is a single BPY_OBJ, the same mesh with the selected faces flattened.

How to install it

ComfyUI Manager, search "Avatar Graph" and install, or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/avatechai/avatar-graph-comfyui

then pip install -r requirements.txt and restart. Needs Blender's bpy module, pinned to Python 3.10.x - a dedicated conda environment on macOS/Linux, or Avatech's prebuilt Python-3.10 ComfyUI zip on Windows with the pack installed through Manager afterward.

Common issues & troubleshooting

If nothing flattens, it's almost certainly a selection issue - this only acts on selected faces, so confirm a selection step ran on the right object before this node in your graph.

If one pass doesn't fully flatten a connected patch of faces, that's expected on anything beyond an isolated single face - raise repeat rather than assuming the operator failed; a handful of passes usually converges to a visibly flat result where one pass alone leaves it noticeably close but not quite there.

A bpy import error at ComfyUI startup is the pack's Python-version pin, not this node - confirm a clean Python 3.10.x environment with requirements.txt installed cleanly.

Categoryblender

Inputs (3)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ
factoroptFLOAT1.00-10–10
repeatoptINT11–10000

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ