Nodes/Avatar Graph/UV Minimize Stretch
ComfyUI Node

UV Minimize Stretch

Relaxing a UV unwrap so the texture doesn't warp

By avatechai·Created 3 years ago·Updated 2 years ago· 264
UV Minimize Stretch
  • BPY_OBJ
  • BPY_OBJ
fill_holestrue
blend0.00
iterations0

One of the more genuinely well-known Blender operators in this pack's set - anyone who's UV-unwrapped anything in Blender has hit Ctrl+V for this. UV Minimize Stretch wraps bpy.ops.uv.minimize_stretch, which iteratively relaxes UV island positions to reduce the area distortion between the 3D mesh and its 2D UV layout - the fix for a texture that looks stretched or squashed in one spot even though the unwrap seams look reasonable.

How it works

Any UV unwrap distorts somewhat - you're flattening a 3D surface onto 2D, and something has to give. A naive projection (like the README's own "Plane Texture Unwrap" step, a UV cube-project on a flattened plane) can leave some triangles stretched relative to their real 3D size, which shows up as a texture that looks correct in some areas and warped in others. This operator nudges UV vertex positions iteratively to even that distortion out, trading a bit of layout tidiness for area accuracy - the result generally looks less "gridded" but maps the texture more evenly.

The inputs and outputs that matter

  • fill_holes (default true) - treat holes in the UV selection as if they were filled while relaxing, generally producing a cleaner result; leave this on unless you have a specific reason not to.
  • blend (default 0, range 0–1) - how much to blend the relaxed result back toward the original layout. 0 is full relaxation; push it up if the relaxed result drifts too far from your original unwrap's shape.
  • iterations (default 0) - how many relaxation passes to run. More iterations converge closer to minimal stretch but cost more time; 0 typically means "run until it stabilizes" rather than literally zero passes.

Output is the same BPY_OBJ, UVs relaxed.

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, cd avatar-graph-comfyui && pip install -r requirements.txt, then restart. Needs Python 3.10.x - bpy only ships wheels for that version, and a newer environment either fails the install or leaves the blender-category nodes missing. macOS/Linux: dedicated conda env at 3.10. Windows: Avatech's prebuilt Python-3.10 ComfyUI zip, pack installed via Manager afterward.

Common issues & troubleshooting

RuntimeError: ... poll() failed. This is a UV Editor operator that needs faces selected with UVs already unwrapped - run it before an unwrap exists, or with nothing selected, and it has no UV layout to relax.

Texture still looks warped after running this. Minimize Stretch improves distortion, it doesn't guarantee a perfect result - for a mesh with genuinely difficult topology to unwrap flat (sharp curvature, complex silhouette), some residual stretch is unavoidable without adding more seams upstream. Bump iterations up before concluding it's not working.

Slow on a dense mesh. This is an iterative relaxation, so cost scales with both mesh density and iterations - if it's the bottleneck in a graph with a heavily subdivided mesh, that's expected, not a malfunction.

Not in the README's node table - like the rest of this pack's blender-category nodes, it's an auto-generated wrapper via generate_blender_types.py, though this specific operator is common and well-documented enough in Blender's own manual that it's easy to look up further.

Categoryblender

Inputs (4)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ
fill_holesoptBOOLEANtrue
blendoptFLOAT0.000–1
iterationsoptINT00–2147483647

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ