Nodes/Avatar Graph/Mesh Average Normals
ComfyUI Node

Mesh Average Normals

Smooth out shading seams where flat mesh pieces meet

By avatechai·Created 3 years ago·Updated 2 years ago· 264
Mesh Average Normals
  • BPY_OBJ
  • BPY_OBJ
average_type
weight50
threshold0.01

Like most of the Mesh_* nodes in Avatar Graph, this isn't custom logic - it's Blender's own bpy.ops.mesh.average_normals operator, wired straight into a ComfyUI node by the pack's code generator (it walks a list of Blender's real mesh operator names and produces one node per operator). That matters practically: if a parameter here confuses you, Blender's own docs and forums are the better resource, not anything ComfyUI-specific - there's no custom behavior layered on top.

Why you'd reach for it

Avatar Graph builds its avatars out of flat mesh layers - a segment for the eyes, a segment for the mouth, generated from traced outlines. Wherever those generated pieces join, or wherever a mesh has been stitched or modified, you can end up with visible shading seams: hard edges in the lighting where there shouldn't be one. Average Normals blends the (custom) normals of selected vertices or faces together, smoothing those seams out without changing the actual geometry.

How it works

There are three blending strategies, picked via average_type: CUSTOM_NORMAL blends whatever custom normal data is already on the selection, FACE_AREA weights the blend by how large each adjacent face is, and CORNER_ANGLE weights it by the angle at each vertex corner. weight (1–100) controls how strongly the blend pulls toward the average - lower keeps more of the original variation, higher flattens it more aggressively. threshold sets an angle cutoff so normals that differ too sharply (an actual hard edge you want to keep, not a seam you want gone) don't get blended together.

The inputs and output that matter

  • BPY_OBJ (optional) - the mesh object to operate on.
  • average_type - pick your blending strategy; FACE_AREA is a reasonable default for uneven, generated geometry.
  • weight (default 50) - the one you'll actually tune per-mesh; push it up if seams are still visible, pull it back if the shading starts looking artificially uniform.
  • threshold (default ~0.01) - leave this alone unless you're seeing genuine hard edges getting incorrectly smoothed.

Output is the same BPY_OBJ, passed through for chaining further operations.

How to install it

Via ComfyUI Manager: search "Avatar Graph" (avatar-graph-comfyui), install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/avatechai/avatar-graph-comfyui
cd avatar-graph-comfyui
pip install -r requirements.txt

The pack's hard blocker: bpy==3.6.0 is pinned in requirements.txt and only builds on Python 3.10.x. Windows users get a bundled Python 3.10 ComfyUI zip from the README; Mac/Linux users should build a dedicated conda environment (conda create --name comfyui python=3.10) rather than fighting an existing 3.11/3.12 setup. Expect a heavier install than usual - segment-anything, mediapipe, and OpenCV all come along.

Common issues & troubleshooting

"Operator poll() failed, context is incorrect." Blender's own error, meaning the object it's been handed either isn't a mesh or has no valid selection to operate on. Make sure BPY_OBJ is coming from an actual mesh-producing step upstream, not an empty or unset object.

No visible change after running it. These nodes automatically switch the object into Blender's Edit Mode, run the operator, then switch back - you don't manage selection state yourself, which means if nothing was selected (or everything got deselected by an earlier step), Average Normals has nothing to act on and quietly does nothing.

Seams are still visible after running this. Try switching average_type to FACE_AREA if you were on CUSTOM_NORMAL - meshes without deliberately authored custom normal data won't get much out of blending normals that were never set in the first place.

Categoryblender

Inputs (4)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ
average_typeoptCOMBO3 options: CUSTOM_NORMAL, FACE_AREA, CORNER_ANGLE
weightoptINT501–100
thresholdoptFLOAT0.010–10

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ