RM Mask Denoise Remap
Map mask brightness to per-region denoise strength
- mask
- mask
A plain noise mask is binary-ish thinking: this region gets redrawn, that region doesn't. But the real world of img2img is a gradient - you might want a background completely frozen at denoise 0, a subject fully regenerated at denoise 1, and a soft middle ground where the two meet. RMMaskDenoiseRemap is the node that turns a mask's brightness into exactly that gradient of denoise strength. Black areas of the mask become one denoise value, white areas another, and everything in between interpolates linearly.
How it works
The math is refreshingly simple: output = black_denoise + mask × (white_denoise − black_denoise), clamped to [0, 1]. A mask that's black where you want to protect and white where you want to regenerate becomes a denoise map where those regions map to the two values you chose. The result is still a MASK - it just now means denoise strength when you feed it into a latent as a noise mask.
The intended chain is spelled out in the source: RMMaskDenoiseRemap → RM Set Latent Noise Mask → sampler. The denoise remap produces the graded mask; Set Latent Noise Mask attaches it to the latent; the sampler applies it. It pairs naturally with the pack's RMMaskCombine, which can build you the region mask in the first place - combine a protect-mask for the person, remap it so the person sits at denoise 0 and the background at denoise 1, and you get a selective rework with a feathered transition instead of a hard edge.
Inputs and outputs that matter
Only three inputs, both denoise values are sliders:
- mask (MASK, required) - the region mask; brightness is the lever.
- white_denoise (default 1.0) - denoise strength where the mask is white.
- black_denoise (default 0.0) - denoise strength where the mask is black.
- Output: mask (MASK) - the remapped mask, ready for a Set Latent Noise Mask.
How to install it
Ships in the RMAutomation pack:
cd ComfyUI/custom_nodes
git clone https://github.com/Moser9815/ComfyUI-RMAutomation
Restart ComfyUI; it's under RMAutomation/Mask. Pure PyTorch, no dependencies.
Common issues
The trap is a mask that's already essentially binary. If your source mask has no intermediate grays, remapping gives you a hard two-value jump, and the "gradient" you hoped for never materializes - blur the mask before this node if you want soft transitions. Also mind the convention: this node treats white as the high value, so if your mask thinks white = "protect," swap the two denoise values (or invert the mask) rather than fighting it. And a mask that's all one value produces a flat remap - every pixel gets the same denoise, which is a no-op you can spot by checking the output isn't doing anything surprising.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — | |
| white_denoise | FLOAT | 1.000–1 | — |
| black_denoise | FLOAT | 0.000–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |