多文本遮罩条件设置
Prompt-by-mask, the precise way to split a scene
- conditioning_to
- clip
- body_masks
- textList
- text0
- text1
- CONDITIONING
MultiTextSetMask ("多文本遮罩条件设置", multi-text mask conditioning) is regional prompting where the regions are arbitrary masks instead of rectangles. You hand it a batch of masks, a matching list of texts, and it returns a conditioning where each text only influences the area inside its own mask. Boxes are easy to draw but wrong-shaped; masks follow the actual subject.
This is the natural upgrade path from area-based regional prompting. A rectangle around a person includes their background and their neighbor; a mask of just the person doesn't. For character work - two people, a subject plus a detailed prop - mask-based conditioning is the version that doesn't bleed attributes across the seam. The technique is the same mask conditioning core ComfyUI uses for inpaint-style conditioning, applied per-region with per-region strength.
How it works
For each mask/text pair it encodes the text, attaches the mask as a conditioning mask, and sets a per-region strength from the canvas editor. One setting worth understanding: set_area_to_bounds. Leave it at "default" and each mask region works in the full canvas context with its own bounds; flip the per-region control and regions get clamped to the mask's own bounds. The first mode is more forgiving for organic scenes; the second is more aggressive isolation. You'll feel the difference in the seams.
Masks come in as MASKS (a batch), texts as a list or individual slots, and it pairs them by index - shortest list wins. Empty text lists throw, so feed it at least one.
The inputs and outputs
conditioning_to- base conditioning to extend.clip- the CLIP for encoding.body_masks(MASKS) - one mask per region.textList, ortext0,text1, ... - one prompt per mask.- Output:
CONDITIONING- the combined conditioning, into the sampler.
You need masks from somewhere: SAM/segmentation nodes, hand-painted masks, or the pack's own mask nodes. The pack doesn't ship the mask generator for you.
Installing it
From ComfyUI_Lam: Manager → "ComfyUI_Lam", or:
cd ComfyUI/custom_nodes
git clone https://github.com/yanlang0123/ComfyUI_Lam
Restart, lam category. No extra models for the node itself. The pack's heavy README install (face-fusion rars, TensorFlow pins) is irrelevant to this node - skip it.
Common issues
The mask-conditioning failure modes are the usual suspects: masks too small leave the region starved of context, so the model renders a floating head with no room for a body; featherless hard masks create visible boundaries where the conditioning abruptly cuts; and mismatched mask/text counts silently drop regions. Blur your masks a bit before feeding them if you see harsh seams.
Also worth saying plainly: this pack's regional nodes are all siblings under the hood - MultiTextSetArea (boxes), MultiTextSetMask (masks), and the two GLIGEN variants. Pick the one whose region shape matches your workflow; don't stack them on the same conditioning unless you enjoy debugging. And the usual pack caveats: Chinese-language UI, near-zero community footprint, and on uninstall delete ComfyUI/web/extensions/lam to kill the leftover popup.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| conditioning_to | CONDITIONING | — | |
| clip | CLIP | — | |
| body_masks | MASKS | — | |
| textListopt | LIST | — | |
| text0opt | TEXT,STRING | — | |
| text1opt | TEXT,STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CONDITIONING | CONDITIONING | — |