Nodes/ComfyUI-MoonNodes/πŸŒ— Moon Mask Maker Simple
ComfyUI Node

πŸŒ— Moon Mask Maker Simple

Masks from a text grid, the fast and dirty way

By m0rtus59Β·Created 3 months agoΒ·Updated 9 days agoΒ· 8
πŸŒ— Moon Mask Maker Simple
    • MASK
    β—„mask_grid0 1β–Ί

    Regional prompting is the classic fix for two characters whose attributes bleed into each other: you split the canvas into areas and give each area its own prompt. The fiddly part is always defining the areas. MoonMaskMaker's answer is gloriously primitive - you type a grid of numbers, and each integer becomes a mask.

    For a quick two-character scene it's honestly the fastest way in the pack to go from "I want a split down the middle" to actual masks. No painting, no coordinates, just a little ASCII map.

    How it works

    Type rows of integers into mask_grid, one row per line. Every unique integer becomes one mask where that integer appears. A classic left/right split looks like:

    0 0 1 1
    0 0 1 1
    0 0 1 1
    

    That gives you two masks: zone 0 on the left, zone 1 on the right. Add a third zone for a bottom region:

    0 0 1 1
    0 0 1 1
    2 2 2 2
    

    Zone 2 now owns the bottom strip. Each zone's mask is computed as grid == zone, and the result is a stack of mask tensors.

    There's one bit of hidden behavior worth knowing: if your grid is tiny, the masks get upscaled with nearest-neighbor resizing to a minimum of 90Γ—90 pixels. So a small grid still produces usable, chunky regions rather than a single-pixel dot that disappears at latent resolution.

    The interface is two things:

    • mask_grid (multiline STRING, default "0 1") - the whole system in one field.
    • MASK output (a list) - one mask per zone, in ascending zone-number order. This is the mask_list input for the Moon Regional Patcher or Moon Multi-Area KSampler.

    Install

    It's part of ComfyUI-MoonNodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/m0rtus59/ComfyUI-MoonNodes.git
    cd ComfyUI-MoonNodes && pip install -r requirements.txt
    

    Restart ComfyUI, or just find the pack in ComfyUI Manager. No extra dependencies, no model downloads.

    Where it falls short

    The trade-off is obvious: your regions are rigid rectangles on a coarse grid. There are no soft edges here, no hand-drawn shapes - the boundaries are hard steps, and at high resolutions you may see the seams. The typical mitigation (from the regional-prompting playbook) is to keep masking active only early in sampling so regions blend back together - that's what head_start_percent on the patcher is for.

    Also keep zone numbering consistent: every row should use the same set of integers, or you'll get a mask for a zone that only touches one row, which is almost never what you meant. If you need actual organic shapes, skip this and use the pack's Moon Mask Maker GUI, which is the same idea but with a real painting canvas and layers. This node is the "good enough for a two-region test" option, and for that it's perfect.

    CategoryMoonNodes

    Inputs (1)

    NameTypeDefaultDescription
    mask_gridSTRING0 1β€”

    Outputs (1)

    NameTypeDescription
    MASKMASKβ€”