Nodes/ComfyUI-Hypnodes/Hypnodes Mask Generator
ComfyUI Node

Hypnodes Mask Generator

Procedural character regions so you never hand-draw a mask again

By hypnichorse·Created 3 months ago·Updated 16 days ago· 0
Hypnodes Mask Generator
  • latent
  • hn_config
  • base_mask
  • mask_1
  • mask_2
  • mask_3
  • mask_4
  • mask_5
  • mask_6
  • mask_7
  • mask_8
  • mask_9
  • mask_10

Regional prompting - giving each character their own slice of the canvas - is the standard answer to the classic multi-character problem where the girl on the left somehow ends up with the girl on the right's hair color. But regional prompting needs masks, and hand-drawing per-character masks in ComfyUI is a chore. The Hypnodes Mask Generator is the chore-killer: it computes the regions procedurally from your latent and the Control Hub's settings.

How it works

You feed it two things: a latent (usually straight from Empty Latent, or from the Hub's chosen resolution) and the hn_config bus. It reads character_count, layout_mode, and mask_blur off the bus and carves the latent's own dimensions into equal regions - no resolution guessing, no stretching, because it measures the actual latent.

The layout logic, with the same naming gotcha as the Hub:

  • Vertical splits the width into equal columns - characters sit side by side, left to right.
  • Horizontal splits the height into equal rows - characters stack top to bottom.
  • Free gives every character the full canvas. That's not a bug; it's the "I'll handle layout myself" escape hatch.

Instead of hard-edged boxes, it applies a gaussian blur to each region based on mask_blur, so the boundaries blend. That blur is the "seam-killer" - hard masks through the whole sample are exactly what produces that collaged, cut-and-paste look. Too much blur and color bleeds between characters; the README's starting point of 6–8 matches the general community guidance that mask edges under ~4px show seams.

The outputs

  • base_mask - a full white mask covering everything, for the global/background pass.
  • mask_1 through mask_10 - one per character slot. Slots beyond your character_count come out black (empty), so downstream nodes don't accidentally act on them.

All outputs are MASK type. Wire mask_1 through mask_n into whatever regional mechanism you use - Attention Coupler, Regional Prompter, or ComfyUI's ConditioningSetMask - alongside the corresponding per-character conditioning from the Hypnodes Conditioner. The README's promise is that mask and prompt stay matched 100%: mask 3 always pairs with character 3.

Where people get burned

Two things. First, the masks are at latent resolution - small and downsampled. If you're applying them to full-res image work, upscale or resize them first. Second, "Free" mode is more of a trap than a feature: every character gets the whole canvas, which defeats the whole point of regional separation. If you pick Free, be ready to do your own masking.

Install

ComfyUI Manager (search Hypnodes) or:

cd ComfyUI/custom_nodes
git clone https://github.com/hypnichorse/ComfyUI-Hypnodes

Restart ComfyUI. No models to download - the pack's only deps are numpy and pillow, both already in ComfyUI. And a reminder this pack is fresh and small; if the exact seam behavior isn't doing it for you, tweak mask_blur on the Hub before touching anything else.

CategoryHypnodes/MultiChar

Inputs (2)

NameTypeDefaultDescription
latentLATENT
hn_configHN_CONFIG

Outputs (11)

NameTypeDescription
base_maskMASK
mask_1MASK
mask_2MASK
mask_3MASK
mask_4MASK
mask_5MASK
mask_6MASK
mask_7MASK
mask_8MASK
mask_9MASK
mask_10MASK