ComfyUI Node

Background Region

The starting point for attention-mask regional prompting

By Acly·Created 3 years ago·Updated about a month ago· 667
Background Region
  • conditioning
  • regions

If you've ever prompted "a woman with red hair on the left, a woman with blue hair on the right" and gotten two women with purple hair, you've hit attribute bleeding - the single most common reason people reach for regional prompting. Conditioning is global by default: one prompt smears both subjects together, and no amount of prompt-wrangling reliably fixes it. ETN_BackgroundRegion is where you start building the fix in Acly's tooling-nodes pack.

It's the first node in a small chain that does attention masking - assigning different prompts to different areas of the canvas. This node holds the background: the prompt that applies everywhere that isn't claimed by another region. Think of it as the base layer. You start a region list here, then stack Define Region nodes on top to carve out the masked areas (the left character, the right character), and finally patch the model with Regions Attention Mask so the sampler actually honors it.

How it works

Regional prompting has a few flavors, and this pack's is the "attention couple" lineage - the region masks are applied inside the model's attention rather than by hard-splitting the latent into boxes. The KB's read on why that's the good kind: attention masking is "less forceful" than condition (area) masking, which "leads to more natural image compositions" instead of the collaged, visible-seam look you get from crude latent regions. The region nodes here are adapted from laksjdjf's attention_couple work, the same technique that powers the seamless regional prompts in Acly's Krita AI Diffusion plugin.

ETN_BackgroundRegion is deliberately the simplest node in the set. It takes only a prompt (conditioning), no mask - because the background is defined by subtraction. Whatever pixels the other regions in your list don't cover, the background prompt fills. That's why it comes first: it seeds the list, and everything else appends to it.

The inputs and outputs that matter

  • conditioning (CONDITIONING) - the background prompt, already encoded through your CLIP Text Encode. This is the "everything else" prompt: the setting, the environment, the mood that isn't one of your masked subjects.

One output:

  • regions (Regions) - the region list, so far containing just the background. Feed it into a Define Region node to add a masked area, or straight into Regions Attention Mask if the background is all you have. The Regions type only connects to this pack's own region nodes.

How to install it

Install the whole pack once. ComfyUI Manager: search ComfyUI Nodes for External Tooling, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/Acly/comfyui-tooling-nodes.git

then restart. No models or heavy dependencies - the region nodes are pure model-patching logic.

Common issues & troubleshooting

Nothing happens to your image. This node alone does nothing visible. It only builds data; the effect kicks in when you route the region list through Regions Attention Mask and feed that patched model to your sampler. A region list that never reaches the attention-mask node is inert.

One region bleeds into another. That's the known trade-off of the technique, not a bug in this node. Attention masking holds bounds better than text-token-only methods but still isn't perfectly airtight, especially when two subjects share attributes (two witches, both with hats, will trade hat designs). Make the masks cleaner and give the subjects more distinct descriptions.

Which architecture are you on? Regional prompting is implemented against a specific attention layout and doesn't port freely across model families. If your base model is exotic and the region nodes error or no-op, that mismatch is the likely cause - confirm the technique supports your architecture.

Categoryexternal_tooling/regions

Inputs (1)

NameTypeDefaultDescription
conditioningCONDITIONING

Outputs (1)

NameTypeDescription
regionsRegions