Nodes/Avatar Graph/Mesh Faces Shade Flat
ComfyUI Node

Mesh Faces Shade Flat

Telling faces to stop blending into their neighbors

By avatechai·Created 3 years ago·Updated 2 years ago· 264
Mesh Faces Shade Flat
  • BPY_OBJ
  • BPY_OBJ

This is a one-line operator with a real visual effect: it sets the selected faces to render with flat shading - each face lit as a single uniform plane, with a visible edge where it meets its neighbors, instead of the normals blending smoothly across the seam.

How it works

It wraps Blender's mesh.faces_shade_flat operator, which just flips a per-face shading flag. No geometry moves, no vertices change position - this only affects how lighting is calculated across the selected faces at render/preview time. Flat shading is what you want on genuinely flat, hard-surface panels; smooth shading (its opposite, Mesh Faces Shade Smooth) is what you want on anything meant to read as a curved, organic surface.

On an Avatar Graph mesh - built up from segmented image planes, insets, and fills rather than sculpted - you'll often end up with a mix: flat planar sections that Blender defaulted to smooth (and now show a subtle, wrong-looking gradient across a face that should be a crisp flat panel), or the reverse. This node is how you correct that per-region rather than toggling shading for the entire object.

The inputs and outputs that matter

  • BPY_OBJ (optional) - the mesh, with the faces you want flat-shaded already selected.

That's the entire parameter list - there's nothing else to configure. Output is the same BPY_OBJ, with the shading flag applied to the selected faces.

How to install it

ComfyUI Manager: search "Avatar Graph" and install. Manually:

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

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

Common issues & troubleshooting

If the shading doesn't visibly change after this node runs, check what's actually selected on BPY_OBJ going in - this node only affects the current face selection, not the whole mesh, so a selection node earlier in the graph that selected the wrong faces (or nothing) will make this step a silent no-op.

If you're exporting to GLB/GLTF and the flat shading you set in this graph doesn't show up in the destination viewer, that's usually the receiving software recalculating its own normals on import rather than this node failing - flat vs. smooth shading is stored per-face on export, but not every downstream tool respects it identically.

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

Categoryblender

Inputs (1)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ