Mesh Paint Mask Extract
Pulling a masked region out as its own mesh in Avatar Graph
- BPY_OBJ
- BPY_OBJ
Avatar Graph's whole pipeline is about turning a flat illustration into pieces you can rig independently - an eye that blinks, a mouth that opens. Mesh Paint Mask Extract is one of the tools for doing that split at the mesh level: give it an object with a paint/sculpt mask on it, and it cuts the masked region out into its own solid piece of geometry, complete with real thickness, instead of leaving you with a flat, floating patch.
How it works
This wraps Blender's mask-extract operator from the sculpt toolset - the same one behind "Extract Mask" in Blender's Mask menu. It reads whatever mask values are currently painted onto the mesh (from a mask brush, or however the mask got set upstream in your graph), decides which vertices count as "inside" the extraction based on a threshold, then builds a new mesh from that region and, by default, cleans it up so it's actually usable: adding an extra boundary loop for cleaner edge topology, relaxing the surface with a few smoothing passes, projecting it back onto the original surface so it hugs the source shape rather than sitting flat, and giving it thickness via a solidify pass so it's a real solid rather than a paper-thin shell.
The inputs and outputs that matter
BPY_OBJ- the object carrying the mask.mask_threshold(default0.5, range 0–1) - how strong a mask value has to be before that area counts as included. Push it higher for a stricter, tighter extraction; lower it to catch softer, partially-masked edges too.add_boundary_loop(defaulttrue) - adds an extra ring of edges around the cut boundary, giving you cleaner topology to work with afterward instead of a raw, jagged edge.smooth_iterations(default4) - how many relaxation passes run on the new mesh's shape. More passes smooth out noisy mask boundaries; fewer keep the extraction closer to the raw mask outline.apply_shrinkwrap(defaulttrue) - projects the extracted piece back onto the original surface so it follows the source geometry's contour rather than staying flat.add_solidify(defaulttrue) - adds real thickness so the result isn't a zero-thickness shell.
Output is a single BPY_OBJ - the newly extracted piece, separate from (and in addition to) the object you started with.
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 - dedicated conda environment on macOS/Linux, or Avatech's prebuilt Python-3.10 ComfyUI zip on Windows plus the pack installed through Manager afterward.
Common issues & troubleshooting
If nothing extracts, check that a mask actually exists on the object going into this node - this operator reads an existing mask, it doesn't paint one. If your graph doesn't have a step that actually sets mask values before this point, mask_threshold has nothing meaningful to work against and you'll get an empty or degenerate result.
If the extracted piece looks warped or doesn't sit where you expect relative to the original, try toggling apply_shrinkwrap off to see the raw, un-projected extraction - that isolates whether the shrinkwrap step is the one distorting things versus the mask boundary itself being noisy (in which case raising smooth_iterations is the more useful fix). And if the piece comes out too thin or too thick for what you need downstream - say, before joining it back into a combined avatar mesh - add_solidify's thickness isn't exposed as a separate parameter here, so you may need a dedicated modifier or solidify node afterward to dial it in further.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| BPY_OBJopt | BPY_OBJ | — | |
| mask_thresholdopt | FLOAT | 0.500–1 | — |
| add_boundary_loopopt | BOOLEAN | true | — |
| smooth_iterationsopt | INT | 40–2147483647 | — |
| apply_shrinkwrapopt | BOOLEAN | true | — |
| add_solidifyopt | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BPY_OBJ | BPY_OBJ | — |