Nodes/RES4LYF/ClownOptions SDE Mask
ComfyUI Node Runs on cloud

ClownOptions SDE Mask

Add SDE noise to only part of the image

By ClownsharkBatwing·Created 2 years ago·Updated 22 days ago· 1,222
ClownOptions SDE Mask
  • mask
  • options
  • options
max1.00
min0.00
invert_maskfalse

SDE sampling in RES4LYF re-injects a bit of noise after every step - that's the eta knob, and it's a big part of how the pack gets its detail. But normally that noise hits the whole frame evenly. This node makes it spatial: paint a mask, and you decide how much SDE noise lands inside the mask versus outside it.

Why you'd want that: SDE noise adds texture and variation, which is great on a face or fabric and distracting on a flat sky or a background you want to stay calm. With a mask you can crank noise where you want richness and keep it near zero everywhere else - a kind of localized detail control that stacks on top of your normal sampling.

How it works

You feed it a MASK and two bounds. Where the mask is white, the SDE noise amount scales toward the max value; where it's black, it scales toward min. In between, it blends. So a soft-edged mask gives you a smooth falloff from noisy to clean across the image, not a hard seam. The result is packaged as an OPTIONS object the sampler reads while it adds its per-step noise.

Note this modulates SDE noise specifically - you need to actually be SDE sampling (eta above 0 on the sampler) for it to have anything to act on.

The inputs that matter

  • mask (MASK, optional) - the region map. White = the max end, black = the min end. This is the whole point of the node; without a mask there's nothing to modulate.
  • max (default 1) - the noise scale in the white areas. Leave near 1 for full noise there.
  • min (default 0) - the noise scale in the black areas. 0 means "no SDE noise here," which is the usual intent - keep the background quiet.
  • invert_mask (default false) - flip which side is which, so you don't have to redraw a mask to swap max/min regions.

Chain in with the optional options input; the output is options (OPTIONS) heading to the sampler.

Installing RES4LYF

ComfyUI Manager: search RES4LYF, install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/ClownsharkBatwing/RES4LYF
pip install -r RES4LYF/requirements.txt

Portable users use the embedded pip (python_embedded/Scripts/pip.exe). Restart, hard-refresh with F5. No models to fetch.

Common issues

No difference at all. Two usual causes: your sampler's eta is 0 (no SDE noise exists to mask), or max and min are the same value (uniform, so the mask does nothing). Set eta above 0 and give max/min a real spread.

The masked edge looks harsh. Use a soft/feathered mask. Hard-edged masks produce a visible noise boundary; a gradient mask blends the transition.

Mask is backwards. If the region you wanted noisy came out clean, flip invert_mask rather than repainting.

It's ignored downstream. As with every ClownOptions node, this only bites once the options output reaches a RES4LYF sampler's options input, directly or via a chain.

CategoryRES4LYF/sampler_options

Inputs (5)

NameTypeDefaultDescription
maxFLOAT1.00-100–100Clamp the max value for the mask.
minFLOAT0.00-100–100Clamp the min value for the mask.
invert_maskBOOLEANfalse
maskoptMASK
optionsoptOPTIONS

Outputs (1)

NameTypeDescription
optionsOPTIONS