Nodes/MultiMaskCouple/MultiMaskCouple
ComfyUI Node

MultiMaskCouple

Your two characters keep trading hair colors — this ComfyUI node fixes it

By tumbowungus·Created 9 months ago·Updated 7 months ago· 1
MultiMaskCouple
  • model
  • clip
  • region_1_positive
  • region_1_negative
  • model
  • positive
  • negative
inputcount1

The classic multi-character failure: you write "a woman in a red dress and a man in a blue suit" and get one figure wearing both. Prompt adherence is global - every token pulls at the whole canvas - so two subjects swap hair, clothes and pose until they smear into a single creature. Regional prompting is the standing fix for this, and MultiMaskCouple is a ComfyUI-native implementation of it: you paint regions on a mask, give each region its own prompt, and the sampler renders them side by side instead of on top of each other.

It's the same family tree as Forge's Attention Couple. The pack started life as improvements to ComfyCouple and got almost entirely rewritten since, which is worth knowing because the lineage tells you how it behaves. It ships two nodes under conditioning > MultiMaskCouple: MaskedRegionCond, the helper that attaches a mask to a prompt pair, and this one, where the actual work happens.

How it works

You don't feed the region prompts into KSampler the normal way. MultiMaskCouple takes your model, clones it, and patches every cross-attention module in the UNet so each pixel attends to its own region's text more than anyone else's. All your region prompts get concatenated into one context, and each one is weighted per-pixel by the mask value: a pixel inside the red region listens mostly to the red prompt, while a pixel on the boundary hears a bit of everything.

That blending is the "coupling," and it's a feature and a bug at once. Regions aren't hard-stamped - they influence each other, which is what keeps the composition coherent rather than collaged - but it also means this is cross-attention token masking, same family as Forge Couple, and it leaks at the edges. The author is upfront about it: "This is not strict masking or inpainting." Small black borders between mask regions are the classic cure.

Two implementation details worth knowing. The coupled attention deliberately runs in fp32 for numerical stability, which costs speed - big images with several regions will feel slower. And the positive/negative it returns are actually empty-prompt encodings; the real conditioning travels inside the patched model clone. If you inspect the outputs expecting to see your prompts, you'll see nothing. Trust the wire, not the inspector.

The inputs that matter

  • model and clip - straight from your CheckpointLoader.
  • inputcount (1–16) - how many region pairs you want. Raise it and the node spawns region_1_positive, region_1_negative, region_2_..., and so on.
  • Each region_N_positive / region_N_negative takes a conditioned prompt pair - usually the outputs of a MaskedRegionCond.
  • Outputs are model, positive, negative, which go into KSampler exactly like an unpatched setup.

Building the workflow

  1. Make a mask image in any editor (Photopea works) with each region a pure RGB color.
  2. Load it, then use one ImageToMask per color (red, green, blue channels) to pull each region's mask.
  3. Per region, CLIPTextEncode a positive and negative prompt, feed them plus the mask into a MaskedRegionCond, and wire its outputs to a region_N pair.
  4. Everything into MultiMaskCouple, outputs into KSampler.

The included example workflow also demonstrates the "global string" trick: shared keywords (setting, quality tags, background) get appended to every regional prompt via a StringConcatenate, so you edit them once instead of in every region.

Install

ComfyUI Manager, search "MultiMaskCouple", or:

cd ComfyUI/custom_nodes
git clone https://github.com/tumbowungus/MultiMaskCouple

Then restart ComfyUI. That's the whole install - there's no requirements.txt and no model files to download; it only uses things ComfyUI already bundles.

Gotchas, from real use

  • It is not an automatic win, especially with three or more masks. Budget for retries.
  • Bleed between regions: add thin black borders between the colors in your mask.
  • Keep masks simple. Masking a detailed pose won't hold - think composition, not outlines. The README says it plainly: masks are about evoking the layout, not dictating it.
  • The mask image should match your output resolution.
  • Overlapping mask colors add (red + green = yellow) and increase bleed. Fine for smoothing interactions, bad for separation.
  • The honest 2026 take: better text encoders have eaten a chunk of this problem. Reach for regional prompting when two characters genuinely need distinct attributes in a specific layout - don't bolt it on for something a better model does in a single prompt.
Categoryconditioning/MultiMaskCouple

Inputs (5)

NameTypeDefaultDescription
modelMODEL
clipCLIP
inputcountINT11–16
region_1_positiveCONDITIONING
region_1_negativeCONDITIONING

Outputs (3)

NameTypeDescription
modelMODEL
positiveCONDITIONING
negativeCONDITIONING