Create Mesh Layer (Advanced)
Finer contour control over Avatar Graph's mesh-from-image node
- image
- BPY_OBJ
- IMAGE
This is the extended version of one of the genuinely documented nodes in Avatar Graph (avatechai/avatar-graph-comfyui) - the pack for rigging a flat character image into a real-time interactive avatar. The plain Create Mesh Layer node does the core job the README describes: turn a segmented image (an eye, a mouth, any face part you want to animate separately) into a textured mesh. This Advanced variant carries the exact same job, plus four extra fields that give you independent control over the inner and outer edges of the traced shape - useful once the default node's output is close but not quite right for a tricky segment.
How it works
Same underlying mechanism as the base node: it traces the visible silhouette of the input image and builds a flat, UV-mapped plane matching that outline. What the Advanced node adds is the ability to nudge the inner and outer boundary of that traced shape independently, rather than just scaling or extruding the whole mesh uniformly. That matters for face parts where the outline isn't a simple blob - an eye segment with a distinct iris/sclera boundary, for instance, where you might want the outer edge (the eye socket outline) to sit differently than the inner edge (around the iris) instead of both scaling together.
The inputs and outputs that matter
Everything from the base node is here - image, convex_hull (default true), shape_threshold (default 0.7), mesh_layer_name (default "mesh_layer"), scale_x/scale_y (default 1), extrude_x/extrude_y (default 0), and seed (default 0) - plus four new ones:
inner_translate_x/inner_translate_y(default0, step0.01) - offsets the inner boundary of the traced contour along each axis.outer_translate_x/outer_translate_y(default0, step0.01) - offsets the outer boundary independently of the inner one.
The small 0.01 step on all four is a hint these are meant for fine adjustment, not big structural changes - you're nudging an already-reasonable contour, not redesigning it from scratch. If you find yourself pushing these values far from zero to get a usable shape, it's worth revisiting shape_threshold and convex_hull on the source segmentation first, since a bad input mask is a cause these four fields can't fully paper over.
Outputs: BPY_OBJ, the mesh object, and IMAGE, the processed image passed back out - identical shape to the base node, so anything downstream (shape keys, Avatar Main Output) works the same regardless of which of the two you used.
How to install it
Via ComfyUI Manager: search "avatar-graph-comfyui", install, restart. Or clone it manually:
cd ComfyUI/custom_nodes
git clone https://github.com/avatechai/avatar-graph-comfyui
cd avatar-graph-comfyui && python -m pip install -r requirements.txt
Because this runs through bpy, the pack needs Python 3.10.x specifically. Windows users get a prebuilt Python 3.10 ComfyUI zip from the README for exactly this reason; on Mac/Linux, build a dedicated conda env (conda create --name comfyui python=3.10) rather than force it into an existing environment. Restart with --enable-cors-header if you want the live avatar preview panel to talk to editor.avatech.ai - file exports work fine without it.
Common issues & troubleshooting
The install is where things actually break. bpy needs Python 3.10 specifically, so a 3.11/3.12 environment - the default on most current ComfyUI installs - won't work at all, and there's a real report of Avatar Graph leaving a ComfyUI Desktop install badly broken after installing it (an oversized UI logo, an unwanted audio-permission popup) badly enough that a clean ComfyUI reinstall didn't fully fix it. Test in a spare, portable ComfyUI instance first if you're not already on a dedicated 3.10 setup.
For the node itself: start with the plain Create Mesh Layer and only reach for this one once you've hit a specific shape you can't fix with shape_threshold, convex_hull, or scale/extrude alone - the four extra translate fields are a fine-tuning layer on top of those, not a replacement for getting the segmentation and base contour settings right first. And per the README's general advice for this whole pipeline: a character image below roughly 768x768, or with poor contrast around the feature you're segmenting, gives the underlying shape tracing less to work with, and no amount of inner/outer translate adjustment reliably fixes a contour that was noisy to begin with.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| imageopt | IMAGE | — | |
| convex_hullopt | BOOLEAN | true | — |
| shape_thresholdopt | FLOAT | 0.70 | — |
| mesh_layer_nameopt | STRING | mesh_layer | — |
| scale_xopt | FLOAT | 1.00 | — |
| scale_yopt | FLOAT | 1.00 | — |
| extrude_xopt | FLOAT | 0.00 | — |
| extrude_yopt | FLOAT | 0.00 | — |
| inner_translate_xopt | FLOAT | 0.00 | — |
| inner_translate_yopt | FLOAT | 0.00 | — |
| outer_translate_xopt | FLOAT | 0.00 | — |
| outer_translate_yopt | FLOAT | 0.00 | — |
| seedopt | INT | 00–18446744073709550000 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| BPY_OBJ | BPY_OBJ | — |
| IMAGE | IMAGE | — |