Object Bake
Flattening Avatar Graph's 3D mesh into a 2D texture
- BPY_OBJ
- BPY_OBJ
This is the most parameter-dense single-purpose node in the pack, and it's doing real work: Object Bake takes whatever's happening on a 3D mesh - lighting, ambient occlusion, normals, a combined render - and flattens it down into a 2D texture image, using the mesh's UV layout to decide where each part of the surface lands on the texture. In Avatar Graph's actual pipeline, this is how you'd generate a texture that accounts for the mesh's own shading (say, baked ambient occlusion for extra depth) rather than only ever painting flat, unlit textures onto your avatar's mesh layers.
How it works
It wraps Blender's full Bake operator, which is why there are so many options - Blender's own bake panel has this many settings too. The core idea: pick a type of data to bake (COMBINED for a full lit render, AO for ambient occlusion, NORMAL for a normal map, UV, ROUGHNESS, and several more), point it at where to write results (target: IMAGE_TEXTURES or VERTEX_COLORS), and Blender projects that data onto the mesh's UV space and writes it out.
The inputs and outputs that matter
The handful that actually drive most bakes:
type- what you're baking:COMBINED,AO,NORMAL,DIFFUSE,EMIT, and others. This is the single most important setting - everything else configures how the bake happens, this decides what gets baked.width/height(both default512) - output texture resolution. Bump these up for a final asset, keep them low while iterating to bake faster.margin(default16) - padding in pixels around each UV island, so texture bleeding doesn't leave visible seams where UV islands meet.use_selected_to_active(defaultfalse) - bakes from one or more selected source objects onto a single active target, the setup you'd use for baking detail from a high-poly reference mesh onto a simpler one.normal_space,normal_r,normal_g,normal_b- only relevant iftypeisNORMAL, controlling the normal map's coordinate convention.filepath- where to write the result if you're saving externally rather than baking into an existing image texture (save_mode:INTERNALvsEXTERNAL).
Output is a single BPY_OBJ, the object the bake was applied to - note that the baked result itself is written to a texture/image, not returned as a separate IMAGE output on this node, so pull the result via whatever texture or file path you configured.
How to install it
ComfyUI Manager, search "Avatar Graph" and install, or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/avatechai/avatar-graph-comfyui
then pip install -r requirements.txt and restart. Needs Blender's bpy module, pinned to Python 3.10.x - a dedicated conda environment on macOS/Linux, or Avatech's prebuilt Python-3.10 ComfyUI zip on Windows with the pack installed through Manager afterward.
Common issues & troubleshooting
If the node won't load, that's the pack's Python-version pin - check ComfyUI's startup console for an import error and confirm a clean Python 3.10.x environment with requirements.txt installed.
If the bake produces a blank or mostly-empty texture, the two usual causes are a missing or overlapping UV layout (bake results land wherever UVs put them, so bad UVs mean a bad bake - run UV Copy or fix the unwrap first) or picking the wrong type for what you actually wanted (a COMBINED bake on an unlit scene produces very different results than AO). Since Blender's bake is also genuinely CPU/GPU-render-engine dependent, a bake that produces nothing at all is also worth checking against whatever render engine and device your headless Blender instance is actually configured to use, rather than assuming this node is broken.
Inputs (23)
| Name | Type | Default | Description |
|---|---|---|---|
| BPY_OBJopt | BPY_OBJ | — | |
| typeopt | COMBO | 12 options: COMBINED, AO, SHADOW, POSITION, NORMAL, UV, +6 | |
| pass_filteropt | COMBO | 8 options: NONE, EMIT, DIRECT, INDIRECT, COLOR, DIFFUSE, +2 | |
| filepathopt | STRING | — | |
| widthopt | INT | 5121–2147483647 | — |
| heightopt | INT | 5121–2147483647 | — |
| marginopt | INT | 160–2147483647 | — |
| margin_typeopt | COMBO | 2 options: ADJACENT_FACES, EXTEND | |
| use_selected_to_activeopt | BOOLEAN | false | — |
| max_ray_distanceopt | FLOAT | 0.000–3.402823466385289e+38 | — |
| cage_extrusionopt | FLOAT | 0.000–3.402823466385289e+38 | — |
| cage_objectopt | STRING | — | |
| normal_spaceopt | COMBO | 2 options: OBJECT, TANGENT | |
| normal_ropt | COMBO | 6 options: POS_X, POS_Y, POS_Z, NEG_X, NEG_Y, NEG_Z | |
| normal_gopt | COMBO | 6 options: POS_X, POS_Y, POS_Z, NEG_X, NEG_Y, NEG_Z | |
| normal_bopt | COMBO | 6 options: POS_X, POS_Y, POS_Z, NEG_X, NEG_Y, NEG_Z | |
| targetopt | COMBO | 2 options: IMAGE_TEXTURES, VERTEX_COLORS | |
| save_modeopt | COMBO | 2 options: INTERNAL, EXTERNAL | |
| use_clearopt | BOOLEAN | false | — |
| use_cageopt | BOOLEAN | false | — |
| use_split_materialsopt | BOOLEAN | false | — |
| use_automatic_nameopt | BOOLEAN | false | — |
| uv_layeropt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BPY_OBJ | BPY_OBJ | — |