Nodes/Hellrunner's Magical Nodes/Mask-Map Loader (HMN)
ComfyUI Node

Mask-Map Loader (HMN)

Turn one RGB bitmap into three attention masks

By Hellrunner2k·Created 2 years ago·Updated about a year ago· 2
Mask-Map Loader (HMN)
    • Mask-Map
    • Red (Center Piece)
    • Green (Theme)
    • Blue (Background)
    image
    Width0
    Height0
    upscale_methodlanczos

    Load Mask-Map is where Hellrunner's regional prompting starts. It opens a single RGB bitmap - a "mask-map" - and splits it into three smooth gradient masks: red, green and blue. Each becomes an attention region in your workflow. If you've fought with hard-edged binary masks that leave visible seams between prompt zones, the pitch here is gradients: smooth falloffs instead of cliffs, so regions blend instead of cutting. The author's usage guide for the system lives in a CivitAI article ("Hellrunner's Mask-Maps - Attention Masking") linked from the pack README, and the pack ships a Substance Designer file (GradiatorMaskMapper.sbsar, viewable in the free Substance Player) for generating your own.

    The inputs that matter

    • image - a dropdown of .bmp files in your ComfyUI input folder, with an upload button. Only BMPs are listed, because that's the lossless-ish format the mask-maps are authored in. RGB, not RGBA.
    • Width / Height - both default to 0, meaning "use the source size." Set either above 0 and the map gets rescaled; set just one and the other is derived to keep aspect.
    • upscale_method - which resampler to use when scaling (nearest-exact, bilinear, area, bicubic, lanczos). Lanczos is the default and is the right call for gradients - nearest would chew up your smooth falloffs into steps.

    How it works

    The maskIt function opens the bitmap, converts it to RGB, and pulls each channel out as a separate float mask scaled to 0–1. Each channel becomes a MASK tensor. Red is the "center piece", green the "theme", blue the "background" - that's the author's naming for how the layers stack. The whole thing is cached by file hash, so reloading the same map doesn't re-decode it. If you want a mask-map that covers 100% of the image with no dead zones, that's the design goal the tooltip calls out: gradient channels that sum to full prompt coverage.

    Outputs and wiring

    • Mask-Map (type MASKMAP) - the full RGB map, for nodes that want the whole thing.
    • Red (Center Piece), Green (Theme), Blue (Background) - three MASK outputs you wire into anything that takes a mask.

    The intended pipeline: Red/Green/Blue masks feed the mask input of Mojo Maker (or Mask-Map Prompt's strengths feed the text side), and the same map's regions become your prompt zones. A mask on its own does nothing; it needs a conditioning node that understands mask + mask_strength to become attention control.

    Installing it

    Same pack, one install. ComfyUI Manager → search "Hellrunner's Magical Nodes", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Hellrunner2k/ComfyUI-HellrunnersMagicalNodes.git
    

    Restart ComfyUI. No extra pip dependencies. The one "extra" is optional: if you want to author your own mask-maps, the .sbsar generator in the pack's MaskMappers/ folder needs Adobe Substance 3D Player (free) to open. You can also just download ready-made mask-maps from the pack's references.

    Troubleshooting

    • The dropdown is empty? You need a .bmp in ComfyUI/input/. The node deliberately lists only BMPs, so a PNG mask-map won't show up.
    • Scaled map looks stepped or banded? You're probably on nearest-exact. Switch to lanczos or bicubic - gradients are what this format is for.
    • Nothing happens in the image even with masks wired? Check that the node downstream actually uses the mask (Mojo Maker's mask input with Mask_strength at 1.0) - a mask alone doesn't steer attention.
    • Keep the source map RGB; an RGBA or indexed-color BMP can come back with unexpected channels.
    CategoryHellrunner's/Mask-Maps

    Inputs (4)

    NameTypeDefaultDescription
    imageCOMBORGB Mask-Map as bmp
    WidthoptINT00–16384Width Override, >0 initializes scaling
    HeightoptINT00–16384Height Override, >0 initializes scaling
    upscale_methodoptCOMBOlanczosUpscaling method to use if scaling

    Outputs (4)

    NameTypeDescription
    Mask-MapMASKMAPMask-Map
    Red (Center Piece)MASKRed Mask (Center Piece)
    Green (Theme)MASKGreen Mask (Theme)
    Blue (Background)MASKBlue Mask (Background)