RS Character Mask
Hand the Sampler a Silhouette Instead of a Box
- building_pipe
- mask
- building_pipe
- region_mask
A point region is one coordinate. A box region is a rectangle, and rectangles are terrible at describing people - an arm sticking out of a box is territory your character prompt doesn't own, and two boxes that overlap give you a shared zone whether you wanted one or not.
RS Character Mask lets you feed an actual MASK into a numbered character slot, so the region that a character prompt owns is the shape of the person. No ControlNet model, no extra weights, nothing to download. You're just being more specific about where those words are allowed to matter.
What it does to the pipe
This is one of the pack's building-pipe nodes. You connect an upstream building_pipe (from Character Prompt, LoRA or Position), it attaches a mask to one character number, and it emits the pipe onward. Two outputs, both useful:
- building_pipe - carry it to Finalize Character Pipe, then into RS MultiCharacter Sampler.
- region_mask - the applied mask as a proper
MASK, after scaling, offset and margin. This is your ground truth. The node's little layout diagram is a shrunken approximation; if you care about pixels, wire this into a preview or a mask-invert check.
The rule that surprises people: a mask beats that character's point or box, regardless of builder order. You don't have to delete your Position node, you just set enabled to false when you want the point/box back. Repeating this node for the same number means the last mask wins, so you can keep a variant parked downstream and flip it on.
The inputs beginners actually touch
- character_id (1–10). It must match the row number in Character Prompt. This is the number one cause of "the mask did nothing" - the mask is being applied, to character 3, while your prompt is character 1.
- mask. One full-canvas mask. White selects, black excludes. Connect one mask per character; grey is not partial strength, it's binarised.
- margin (0–128, default 24). Expands the white region in source-mask pixels. This is where you leave room for hair, clothes and hands that meet someone else's hands. Use 0 if your mask is already generous.
- threshold (default 0.5) - the black/white cut line.
- offset_x / offset_y / scale - cosmetic-ish nudges in canvas fractions and a uniform ratio around the canvas centre. Applied in the order scale → shift → margin, and overflow is clipped, never wrapped. Off-canvas stays off-canvas, and if the whole mask falls outside you get an error rather than a silent empty region.
Wiring it up, in order
The pack's assembly pipe is order-independent for execution, but for live editing you want Mask → Position → Finalize. The Position node reads upstream shapes so you can see and drag your silhouette before you sample; masks connected after Position only show up in Finalize's guide.
Install
One clone covers all fifteen nodes in the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/raspie10032/ComfyUI_RS_MultiCharacter_Sampler.git
Restart ComfyUI and hard-refresh the browser. Or find RS MultiCharacter Sampler in ComfyUI-Manager (registry package comfyui-rs-multicharacter-sampler). Core needs Python 3.11+, Torch, NumPy, Pillow ≥10 - the detailer and image-reference extras are separate requirements files you can skip. Node category: RS MultiCharacter/Characters.
Common issues
Your mask reads as empty. Use ComfyUI's Load Image (as Mask) and set the channel to red. Plain Load Image derives its MASK output from the alpha channel, so an ordinary opaque black-and-white PNG comes through with nothing in it - the pack's docs call this out because it's the single most repeated confusion. Also make sure the mask and the output share an aspect ratio: the mask is resized to the full canvas, not cropped.
MOSS silently turns your blob into a rectangle. If the sampler's layout is MOSS native, masks get converted to their enclosing bounding box, so a careful silhouette degrades into a box. Switch to regional layout if the shape matters. Text regions are boxes no matter what - masks are for characters.
Nothing changed on a two-person layout. Two things to check: whether the mask actually covers the area where you wanted the prompt to land (look at region_mask, not the thumbnail), and whether you're asking too much of it. The mask biases prompt attention, it does not pin the pose. If your character's feet end up outside the mask, that's the model, not the node - the pack is explicit that this doesn't guarantee people count, anatomy or composition.
Overlaps do something useful, on purpose. Where two masks intersect, both character captions read; everything outside every explicit region reads the sampler's common prompt.
Keep it to ten regions total across characters and text, and masks ≤ 4096×4096.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| character_id | INT | 11–10 | Match this number to the Character Prompt row. |
| enabled | BOOLEAN | true | Off removes this character's mask and restores its point/box settings. |
| margin | INT | 240–128 | Expand the white region in source-mask pixels. Leave room for hair, clothes and interaction. |
| threshold | FLOAT | 0.500–1 | Pixels above this value become white. Gray is not a continuous prompt strength. |
| building_pipeopt | RS_MC_BUILD_PIPE,RS_MC_CHARACTER_PIPE,NAI_CONTEXT | — | |
| maskopt | MASK | One full-canvas mask. White selects this character; black excludes it. Parts moved or enlarged outside the canvas are clipped. | |
| offset_xopt | FLOAT | 0.00-1–1 | Horizontal shift as a fraction of canvas width. Positive moves right; outside is clipped. |
| offset_yopt | FLOAT | 0.00-1–1 | Vertical shift as a fraction of canvas height. Positive moves down; outside is clipped. |
| scaleopt | FLOAT | 1.000.05–4 | Uniform size ratio about the canvas centre: 0.5 half, 1 original, 2 double. Keeps aspect ratio; outside is clipped. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| building_pipe | RS_MC_BUILD_PIPE | — |
| region_mask | MASK | — |