Nodes/Avatar Graph/UV Lightmap Pack
ComfyUI Node

UV Lightmap Pack

A bake-ready layout without wrecking your texture UVs

By avatechai·Created 3 years ago·Updated 2 years ago· 264
UV Lightmap Pack
  • BPY_OBJ
  • BPY_OBJ
PREF_CONTEXT
PREF_PACK_IN_ONEtrue
PREF_NEW_UVLAYERfalse
PREF_BOX_DIV12
PREF_MARGIN_DIV0.10

UV Lightmap Pack is the packer you use when you want a rigid, box-grid layout instead of Blender's smarter island packing. Its job is to arrange UV islands into a grid of evenly-sized square cells - the classic layout for baking lightmaps and ambient occlusion, where you don't care about a clever fit, you care that every face gets roughly equal space and nothing overlaps. It's niche, but when you need it, it's the only node that does it.

How it works

It wraps bpy.ops.uv.lightmap_pack on your BPY_OBJ - same auto-generated pattern as every UV_* node in the Avatar Graph pack: enter edit mode, run the operator, return the object. The inputs are the operator's, named exactly as Blender names them:

  • PREF_CONTEXT - SEL_FACES packs only the selected faces; ALL_FACES packs everything. The one you'll flip most.
  • PREF_PACK_IN_ONE (default on) - pack everything into a single 0–1 map instead of spreading across multiple tiles.
  • PREF_NEW_UVLAYER - this one's the gem. When on, the packed layout goes onto a new UV layer and your existing texture UVs are left untouched. In the avatar context that's exactly what you want if you only need a bake pass and don't want to nuke the layout your texture depends on.
  • PREF_BOX_DIV - grid divisions per box (default 12, range 1–48). Higher = more, smaller cells; it trades cell count against usable space per face.
  • PREF_MARGIN_DIV - margin between boxes as a fraction (default 0.1). Raise it if baked results bleed between cells.

Output is the same BPY_OBJ.

Where it fits

Honestly? Most Avatar Graph users will never touch this. The default UV Pack Islands gives a tighter, texture-friendly result and is what you want for the character's main map. Lightmap Pack earns its keep only when you're doing the separate baking pass - ambient occlusion, lightmaps, cavity - where a uniform grid is the point. The PREF_NEW_UVLAYER option is the one reason to remember it exists: it lets you generate that bake layout without destroying the UVs your mouth and eye textures rely on. If you never bake, skip it.

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. Or install via ComfyUI Manager, searching Avatar Graph.

Same pack-wide gotchas: it pins bpy==3.6.0, which only builds on Python 3.10.x - a newer Python fails the install and loads nothing. First launch pulls the ~2.5 GB SAM model, so don't panic at the long start. And the README flags the pack as still in development; pin the version once you have a working workflow.

Categoryblender

Inputs (6)

NameTypeDefaultDescription
BPY_OBJoptBPY_OBJ
PREF_CONTEXToptCOMBO2 options: SEL_FACES, ALL_FACES
PREF_PACK_IN_ONEoptBOOLEANtrue
PREF_NEW_UVLAYERoptBOOLEANfalse
PREF_BOX_DIVoptINT121–48
PREF_MARGIN_DIVoptFLOAT0.100.001000000047497451–1

Outputs (1)

NameTypeDescription
BPY_OBJBPY_OBJ