Nodes/ComfyUI-TextureAlchemy/Texture Atlas Builder
ComfyUI Node

Texture Atlas Builder

Building a texture atlas without leaving ComfyUI

By amtarr·Created 9 months ago·Updated 4 months ago· 58
Texture Atlas Builder
  • tex1
  • tex2
  • tex3
  • tex4
  • tex5
  • tex6
  • tex7
  • tex8
  • tex9
  • tex10
  • tex11
  • tex12
  • tex13
  • tex14
  • tex15
  • tex16
  • atlas
layout
spacing0
background_color0.00

A texture atlas is just a bunch of textures glued onto one canvas so a game engine or DCC tool can read them from a single file and compute the UVs itself. Texture Atlas Builder does exactly that: it takes up to sixteen images, arranges them into a grid, and hands you back one atlas.

Why would you want this inside ComfyUI? Two reasons, really. The practical one: when you've run a material through this pack and ended up with albedo, normal, roughness, metallic, and AO maps, a 2x2 atlas is the fastest way to eyeball all five at once instead of opening separate PNGs. The engine-bound one: some pipelines (character sheets, UI sprites, trim sheets) genuinely want everything in a single texture, and this node saves you the Photoshop step.

How it works

The node is dead simple under the hood, which is mostly a compliment. It parses your layout string into rows × columns, collects whichever of the tex1 through tex16 inputs you actually connected, then sizes every cell to the largest texture in the batch and drops each image into its cell. spacing adds a gap in pixels between cells, and background_color fills whatever canvas is left.

That last bit is worth knowing: cells size to the max dimensions, so this is not a "smart" atlas packer. It won't scale your textures to fit, and it won't pack them tightly. If you feed it a mix of 1024×1024 and 512×512 maps, the small ones sit in oversized cells with background showing around them. Keep your sources the same resolution and you'll be happy.

The inputs that matter

You don't need all sixteen slots - everything except layout, spacing, and background_color is optional, and empty slots are simply skipped.

  • layout - the grid shape: 2x2, 3x3, 4x4, or the strip shapes 1x24x1. This is the whole job, so set it first.
  • spacing (0–50 px) - gap between cells. Zero is fine for a quick preview; a few pixels makes tiles easier to read at a glance.
  • background_color (0.0–1.0) - one grayscale value. 0.0 is black, 1.0 is white. There's no RGB picker here, so if you want colored gaps you'll need to fill that in elsewhere.

The single output, atlas, is an IMAGE - wire it straight into Save Image or Preview Image.

Installing it

Texture Atlas Builder ships in the ComfyUI-TextureAlchemy pack. Easiest route is ComfyUI Manager: search "Texture Alchemy" and install, then restart ComfyUI. Or do it by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/amtarr/ComfyUI-TextureAlchemy
# restart ComfyUI

No extra pip packages, no model downloads - this node is pure PyTorch on ComfyUI's bundled install. You'll find it under Add Node → Texture Alchemist → Analysis. One stale note: the README still tells you to copy a folder named ComfyUI_PBR_MaterialProcessor into custom_nodes - that was the pack's name before the rebrand, so ignore it and use Manager or the git clone instead.

Gotchas

The two that actually bite: mixed resolutions produce ragged cells (resize everything to the same size first - Texture Scaler is right there in the same pack), and there's no padding for mipmap bleeding. For a preview atlas, no problem. For an atlas you're shipping into a game engine with mipmaps enabled, you'll want baked padding around each cell, which this node won't give you - expect to add that in your texturing tool.

CategoryTexture Alchemist/Analysis

Inputs (19)

NameTypeDefaultDescription
layoutCOMBO9 options: 2x2, 3x3, 4x4, 1x2, 1x3, 1x4, +3
spacingINT00–50Pixels between textures
background_colorFLOAT0.000–1
tex1optIMAGE
tex2optIMAGE
tex3optIMAGE
tex4optIMAGE
tex5optIMAGE
tex6optIMAGE
tex7optIMAGE
tex8optIMAGE
tex9optIMAGE
tex10optIMAGE
tex11optIMAGE
tex12optIMAGE
tex13optIMAGE
tex14optIMAGE
tex15optIMAGE
tex16optIMAGE

Outputs (1)

NameTypeDescription
atlasIMAGE