Nodes/Avatar Graph/UV Pack Islands
ComfyUI Node

UV Pack Islands

Stop wasting texture resolution

By avatechai·Created 3 years ago·Updated 2 years ago· 264
UV Pack Islands
  • BPY_OBJ
  • BPY_OBJ
udim_source
rotatetrue
rotate_method
scaletrue
merge_overlapfalse
margin_method
margin0.00
pinfalse
pin_method
shape_method

UV Pack Islands is the cleanup pass every unwrap needs. After you've projected or flattened your mesh, the UV islands are scattered all over the map with gaps between them - and every gap is texture resolution you paid for and aren't using. This node shoves all the islands into the 0–1 UV square (or a UDIM tile) as tightly as it can, so your character's texture gets the most pixels per inch of face. It's the node you run right before you call the avatar done.

How it works

It's another auto-generated Blender wrapper in the Avatar Graph pack, this time around bpy.ops.uv.pack_islands - Blender's modern, xatlas-based packer, which since 3.x is genuinely good at this. Feed it a BPY_OBJ and it rearranges existing UV islands in place, then returns the same object. There's no reprojection involved; it just moves and rotates what's already there.

Most of the inputs you can leave alone, but a few are worth knowing:

  • margin - the gap between islands, in UV units. 0.001 is hairline; 0.020.05 gives breathing room. Too small and you get bleeding between islands at low texture res.
  • rotate and rotate_method - rotation lets the packer fit islands tighter. ANY allows arbitrary angles (tightest pack), AXIS_ALIGNED is the safest. If you're OCD about axis-aligned UVs, set rotate_method to CARDINAL or AXIS_ALIGNED.
  • scale - when on (default), the packer rescales islands to equal texel density. Turn it off only if you deliberately made some islands bigger and want that respected.
  • shape_method - CONCAVE uses the true island shape (tighter pack), AABB uses bounding boxes (faster, looser).
  • pin / pin_method - pins islands in place so the packer can't move them. Handy if you've manually placed the face and only want the leftovers packed around it.
  • udim_source - where the packer puts things when you have UDIM tiles.

Output is the single BPY_OBJ you fed in.

Where it fits

In an Avatar Graph build, your eye, mouth, and face layers each get their own mesh and their own texture. Running Pack Islands on the shared/joined mesh after unwrapping means all those islands share the same map efficiently - which matters once you're exporting a .GLB/.GLTF for the Avatech editor and real-time preview. A sloppy pack shows up as a soft, blurry mouth close-up; a tight one keeps the lipsync crisp.

One honest note: because the mesh lives inside the pack's embedded Blender session, you won't see a visual UV editor - you judge the result by how the final texture looks. If you're trying to iterate, keep the parameters stable and change one at a time.

Installing Avatar Graph

This node ships in the Avatar Graph pack from Avatech. From ComfyUI/custom_nodes:

git clone https://github.com/avatechai/avatar-graph-comfyui
cd avatar-graph-comfyui
python -m pip install -r requirements.txt

then restart ComfyUI with --enable-cors-header. ComfyUI Manager users: search Avatar Graph → Install.

Gotchas: the pack pins bpy==3.6.0, which needs Python 3.10.x - on any other version the pip install fails and the pack won't load. First launch auto-downloads the SAM ViT-H model (~2.5 GB), so a slow first start is expected. And the pack README openly says it's still changing - pin the version once you have something working.

Categoryblender

Inputs (11)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ
udim_sourceoptCOMBO3 options: CLOSEST_UDIM, ACTIVE_UDIM, ORIGINAL_AABB
rotateoptBOOLEANtrue
rotate_methodoptCOMBO3 options: AXIS_ALIGNED, CARDINAL, ANY
scaleoptBOOLEANtrue
merge_overlapoptBOOLEANfalse
margin_methodoptCOMBO3 options: SCALED, ADD, FRACTION
marginoptFLOAT0.000–1
pinoptBOOLEANfalse
pin_methodoptCOMBO4 options: SCALE, ROTATION, ROTATION_SCALE, LOCKED
shape_methodoptCOMBO3 options: CONCAVE, CONVEX, AABB

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ