Nodes/Avatar Graph/Mesh Tris Convert To Quads
ComfyUI Node

Mesh Tris Convert To Quads

ComfyUI Node Guide

By avatechai·Created 3 years ago·Updated 2 years ago· 264
Mesh Tris Convert To Quads
  • BPY_OBJ
  • BPY_OBJ
face_threshold0.70
shape_threshold0.70
uvsfalse
vcolsfalse
seamfalse
sharpfalse
materialsfalse

This is a genuinely useful cleanup node if you're generating meshes programmatically, which is exactly what Avatar Graph does. It's part of Avatech's node pack for turning flat character illustrations into rigged, real-time avatars in ComfyUI - you segment the artwork, build mesh geometry for each part, and drive it with shape keys. Mesh generated automatically from image segmentation or booleans tends to come out as triangles, which aren't ideal for clean deformation and shading - this node fixes that.

It wraps Blender's bpy.ops.mesh.tris_convert_to_quads directly - the "Tris to Quads" tool from Blender's Face menu. It looks at pairs of adjacent triangles and merges them back into a single quad wherever the geometry is close enough to a clean rectangle, based on angle thresholds you control. It's the standard fix for messy triangulated topology, and it matters here specifically because Avatar Graph's mesh-generation nodes (building layers from segmented image parts) naturally produce triangulated geometry that benefits from this pass before you move on to UV unwrapping or deformation setup.

The inputs that actually shape the result:

  • face_threshold - the maximum angle (in radians) between adjacent triangle faces for them to be considered mergeable. The default, roughly 0.698 radians (about 40°), is a reasonable middle ground - lower it for stricter merging that only combines nearly-flat pairs, raise it to merge more aggressively.
  • shape_threshold - a second angle threshold, this time checking how close the resulting quad's shape is to a "nice" quad rather than a skewed one. Same units, same default.
  • uvs, vcols, seam, sharp, materials - boundary flags. Turn any of these on and the tool will refuse to merge triangles across a UV seam, vertex color boundary, edge seam, sharp edge, or material boundary, respectively. If your mesh has meaningful seams you want preserved (which, for a textured avatar part, it probably does), turning uvs and seam on before running this is worth doing - otherwise the merge can quietly blur a boundary you cared about.

Output is the same BPY_OBJ with cleaner quad-dominant topology.

Installing it: no standalone install - this comes with the full Avatar Graph pack, roughly 100 nodes in total. Easiest route is ComfyUI Manager, searching "Avatar Graph" or avatar-graph-comfyui. Manual install: cd ComfyUI/custom_nodes, then git clone https://github.com/avatechai/avatar-graph-comfyui, cd in, pip install -r requirements.txt, restart ComfyUI.

The install detail that actually causes failures: this pack requires Python 3.10.x, no exceptions, because its bpy dependency (Blender's Python API, packaged standalone) only ships wheels for that version. If your ComfyUI environment runs a newer Python - the default for most current installs - expect the install to fail rather than partially work. The README's fix is a dedicated environment: conda create --name comfyui python=3.10, activate, install ComfyUI's requirements, then this pack's. If you want the live avatar preview in Avatech's own web editor, launch with --enable-cors-header (Mac: add --force-fp16); without it, mesh cleanup and everything else still runs correctly, you just export .glb/.gltf instead of getting a live in-browser update.

Worth remembering: like most of this pack, if you're not seeing the merge behave the way you expect, first check whether your seam/UV boundary flags are set the way you want - that's the usual culprit, not a bug in the node.

Categoryblender

Inputs (8)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ
face_thresholdoptFLOAT0.700–3.141592741012573
shape_thresholdoptFLOAT0.700–3.141592741012573
uvsoptBOOLEANfalse
vcolsoptBOOLEANfalse
seamoptBOOLEANfalse
sharpoptBOOLEANfalse
materialsoptBOOLEANfalse

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ