Mask Map
Four grayscale maps, one RGBA channel-pack
- metallic
- ambient_occlusion
- detail_mask
- smoothness
- mask_map
PBR pipelines pack four grayscale textures into a single RGBA image all the time - metallic, occlusion, detail, and smoothness riding in the R, G, B, and A channels - because game engines and renderers read them that way as one "mask map" texture. Mask Map is the node that does that packing for you in ComfyUI: four IMAGE inputs in, one RGBA IMAGE out.
This is a niche node with a specific audience: people generating PBR material textures (the pack has a whole PBR section - Detail Map, Roughness To Smoothness, plus this). If you're building materials with generated albedo/normal/roughness maps and need them in the engine-ready packed form, this saves you a trip through an image editor's channel mixer. If you've never packed a material map, this node is quietly not for you - it does exactly one thing and it's the right thing only in that context.
Inputs and outputs
metallic,ambient_occlusion,detail_mask,smoothness(IMAGE) - the four grayscale inputs.mask_map(IMAGE) out - the packed RGBA result, same batch size as the inputs.
How it works
For each image in the batch it grabs the red channel of each input (grayscale images work straight in - a 2D mask tensor is converted to RGB first, then its first channel is used) and merges those four into Image.merge("RGBA", ...): metallic → R, ambient occlusion → G, detail → B, smoothness → A. Then it stacks the results back into a batch. Channel order is fixed and non-negotiable, so make sure you know which engine's convention you're writing for - Unity's mask map order differs from other engines'.
Where it fits
At the end of a texture-generation chain, right before saving a packed material asset. Feed it the four maps your material pipeline produced, save the output, drop it into your renderer. Because it accepts 2D masks as well as RGB tensors, it's forgiving about whether your maps came out of a mask node or an image node.
Install
FairLab, one pack: ComfyUI Manager (search ComfyUI-FairLab) or:
cd ComfyUI/custom_nodes
git clone https://github.com/yanhuifair/ComfyUI-FairLab.git
cd ComfyUI-FairLab
pip install -r requirements.txt
Restart, then look under Fair/image. No extra dependencies beyond the pack's standard install.
Gotchas
- All four inputs must have matching batch counts - it zips them together, so a 4-image batch against a 1-image batch silently uses the first input of the shorter list.
- It takes the first channel of each input. If you feed an RGB map where the real data is in a different channel, you'll pack the wrong thing.
- Channel order is fixed (R/G/B/A = metallic/occlusion/detail/smoothness). If your target engine expects a different layout, you'll need to reorder - this node won't.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| metallic | IMAGE | — | |
| ambient_occlusion | IMAGE | — | |
| detail_mask | IMAGE | — | |
| smoothness | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| mask_map | IMAGE | — |