Nodes/Avatar Graph/Mesh Fill Grid
ComfyUI Node

Mesh Fill Grid

Patching a gap with quads instead of a triangle fan

By avatechai·Created 3 years ago·Updated 2 years ago· 264
Mesh Fill Grid
  • BPY_OBJ
  • BPY_OBJ
span1
offset0
use_interp_simplefalse

Where Mesh Fill closes a loop with triangles, this node closes it with a clean grid of quads - the same "Grid Fill" you'd reach for in Blender any time you want a topologically tidy patch instead of a triangle fan. The catch: it needs the loop to cooperate. An uneven or oddly-shaped boundary won't grid-fill cleanly no matter what you set.

How it works

This wraps Blender's mesh.fill_grid operator. It takes the selected boundary loop, figures out how to pair opposite sides of it into rows and columns, and fills the interior with a regular quad grid - the kind of topology that deforms predictably under a Subdivision Surface modifier or a shape key, which matters if this mesh is headed toward Avatar Graph's Mesh Modify Shape Key node later in the graph. For that reason, on a mesh that's going to be rigged and animated rather than just exported as a static shape, Grid Fill is usually the better default over plain triangle Fill even though it's fussier to get working.

The inputs and outputs that matter

  • BPY_OBJ (optional) - the mesh, with the boundary loop to fill already selected. It generally needs an even number of edges around the loop for the pairing to work out cleanly.
  • span (default 1) - how many rows deep the grid extends before it wraps to the opposite side. Raise it if the loop is long and thin and the default pairing is grouping the wrong edges together.
  • offset (default 0) - shifts which vertex on one side of the loop pairs with which vertex on the other, rotating the pairing around the loop. This is the field to nudge if the grid fills but comes out twisted or crossed.
  • use_interp_simple (default false) - a simpler, more linear interpolation for the new interior verts' positions, instead of Blender's default smoother blend. Mostly matters on a loop with pronounced curvature.

Output is a single BPY_OBJ, the mesh with the grid patch in place.

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

The fill fails or produces nothing. Grid Fill needs a loop with an even number of edges - an odd-count boundary simply can't be paired into rows and columns evenly. If your loop is odd-sided by nature, use Mesh Fill instead, or add/remove one edge on the boundary first.

The grid fills but looks twisted or pinched. Adjust offset - this shifts the pairing around the loop by one vertex at a time, and the "wrong" pairing is the single most common cause of a visibly wrong grid fill.

Result is technically fine but the interior curvature looks off. Try toggling use_interp_simple - on a strongly curved loop, the two interpolation modes can noticeably change how the new interior vertices are placed.

Categoryblender

Inputs (4)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ
spanoptINT11–1000
offsetoptINT0-1000–1000
use_interp_simpleoptBOOLEANfalse

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ