Nodes/RS MultiCharacter Sampler (Hangeul)/RS Character Mask Drawing
ComfyUI Node

RS Character Mask Drawing

Paint Two Blobs Over a Reference, Get Two Characters

By raspie10032·Created 2 months ago·Updated about 8 hours ago· 19
RS Character Mask Drawing
  • building_pipe
  • building_pipe
◄drawing{"version":1,"width":768,"height":1024,"layers":{}}►
◄margin24►

Every regional-prompting tool eventually hits the same wall: coordinates are a miserable way to describe a person. Typing "x 0.2, y 0.35" and hoping it lands on the left character's shoulder is the sort of workflow that makes people go back to one-character prompts.

RS Character Mask Drawing replaces that with a canvas. You drop in a reference image, pick a number, paint the person, repeat for number two. The reference is only a guide - it never enters generation as an img2img source - so you can sketch over a rough stick figure, a photo, or a composition thumbnail and it costs you nothing but the strokes.

Points and boxes are fast, and I still use them for text regions, but for two people with interacting silhouettes, painting is simply faster to get right.

How it works under the hood

The node's real input is drawing: a JSON blob describing the canvas size and a set of numbered layers, each with brush/eraser strokes and its own x, y and scale. The pack's front-end swaps that widget for a painting surface (that's web/mask_drawing.js in the repo), so what you interact with is a canvas, but what gets saved in the workflow is a compact string of stroke coordinates.

The limits it enforces: canvas 64–2048 px per side, up to ten layers numbered 1–10, up to 2,000 strokes per layer and a 4 MB ceiling on the drawing string. Blow past that and you get an actionable error, not a corrupt workflow.

The layers map straight onto prompt rows. Layer 2 is read by Character Prompt row 2 - the reference person you painted over is irrelevant, there's no recognition, no tagging, no auto-identity step. Blank layers fall back to that character's XY point or box - handy: paint only the awkward character and leave the easy one on a point.

The two inputs

  • drawing - the painted layers. You open a reference image with the node's own image button (it uploads into input/RS_MaskDrawing/, and the drawing only stores a filename descriptor, so your workflow JSON doesn't balloon). Only the masks go into generation; the guide image is display-only.
  • margin (0–128, default 24) - extra white space around each painted layer, measured in drawing-canvas pixels, not output pixels. Leave room for hair and props that spill past your brush strokes.

Plus the optional building_pipe input, and a single building_pipe output. No mask output on this one, so if you want to eyeball the result, look at the Position node's layout guide or push the pipe through Finalize.

Two things the docs are firm about: painting past the canvas is clipped rather than wrapped, and the drawing canvas keeps the reference's aspect ratio at a 2048 px long edge - so paint over a reference with roughly your output's proportions, or the same blob will look squashed.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/raspie10032/ComfyUI_RS_MultiCharacter_Sampler.git

Restart ComfyUI, then hard-refresh the browser - the painting canvas is a JavaScript widget, so a stale cached page will show you a plain text box where the canvas should be. Manager users: search RS MultiCharacter Sampler (package comfyui-rs-multicharacter-sampler). Nothing to download; core dependencies are just Torch, NumPy and Pillow on Python 3.11+. Look for it under RS MultiCharacter/Characters.

Common issues

You see a text field, not a canvas. Browser cache - Ctrl-F5. If it persists you probably have a second, older copy of the pack installed alongside; the README says keep exactly one.

The masks didn't apply. Order matters for what wins: a later mask source replaces the same number's painted layer. If you have both an RS Character Mask node and this one on the same character, the one connected later in the pipe takes effect. For live editing, put Mask / Mask Drawing → Position → Finalize, because the Position editor reads shapes from upstream and will happily show you stale ones otherwise.

Your reference disappeared after you moved the workflow. Expected. The image lives in ComfyUI's input folder, not in the graph. The painted masks restore from the strokes either way - you just lose the guide picture. Re-open it if you need to repaint.

You tried to paint a text region. Can't. Text slots only take boxes from the Position node.

The character is still in the wrong place. Same caveat as everything in this pack: this is a region guide for prompt attention, not a pose lock. If the model decides the arm goes outside your painted shape, it goes outside your painted shape. Paint generously, then trust the prompt.

For MOSS native layout, remember painted shapes get converted to enclosing rectangles - pick regional if you want the silhouette to survive.

CategoryRS MultiCharacter/Characters

Inputs (3)

NameTypeDefaultDescription
drawingSTRING{"version":1,"width":768,"height":1024,"layers":{}}Paint numbered layers over a reference image. Only the masks enter generation.
marginINT240–128Extra space around painted layers, in drawing-canvas pixels.
building_pipeoptRS_MC_BUILD_PIPE,RS_MC_CHARACTER_PIPE,NAI_CONTEXT—

Outputs (1)

NameTypeDescription
building_pipeRS_MC_BUILD_PIPE—