Nodes/ComfyUI-NynxzNodes/SoftPaint Sampler
ComfyUI Node

SoftPaint Sampler

Edit through a soft mask without Differential Diffusion

By Nynxz·Created 11 months ago·Updated about 12 hours ago· 4
SoftPaint Sampler
    • sampler
    ◄inner_steps2►
    ◄step_size0.20►
    ◄tether5.0►
    ◄curve2.0►
    ◄warm_starttrue►
    ◄mask_meansedit strength►

    If you've done masked editing in ComfyUI, you've met Differential Diffusion. It takes a graded denoise mask - 0 means "leave this pixel alone", 1 means "redraw it" - and turns each pixel's value into a start time: the sampler pins the pixel to the source until the noise level where DD would begin it, then lets go. Low mask values barely edit. High values edit freely. Except "freely" is the problem, because a pixel that goes from pinned to free has a boundary, and boundaries show up as seams.

    SoftPaint Sampler is a different reading of the same mask. Every pixel stays tethered to the source by a strength that follows its mask value, and that tether loosens as the noise falls. Instead of a hard release, each step runs a short Langevin loop - inner_steps extra model calls - so the model can settle inside the tether. Weak mask values still edit. Full ones blend in without a seam, because nothing ever switched abruptly.

    It's a SAMPLER output, so it goes into SamplerCustom or SamplerCustomAdvanced, not a KSampler. And it does not need Differential Diffusion. If DD is on the model, this sampler ignores it - it reads the mask itself.

    The inputs

    inner_steps (2, range 1–8) is Langevin updates per sampling step, one model call each. Two is the paper's sweet spot and honestly past three it's diminishing returns on a much slower run. step_size (0.2, 0.01–2) is how far each update moves in units of the noise level - higher settles faster and noisier.

    tether (5, 0–20, half steps) is the one you'll actually be adjusting. It's how hard low-mask pixels are held to the source, and it behaves like a guidance scale for the source image: raise it to keep structure, lower it to let weak mask values edit more. curve (2) is how mask values map to freedom - at 2 the edit is roughly linear in the mask value, and higher values make the middle of the range edit more. warm_start (on) begins each step's inner loop from the noised source wherever the tether is strongest; turn it off and two inner steps can leave grain at mask edges.

    Then the optional mask_means, which is the setting that decides whether this node behaves like the paper or like DD:

    • edit strength (default) - edits rise evenly with the mask value. A middle value already rebuilds most of the pixel, and a background at 0.05 still gets its texture redrawn. So masks you tuned for Differential Diffusion will edit far more here.
    • denoise - DD's reading: hold each pixel to the source until the noise level DD would start it at, then hand over gradually. Region Latent's values mean what they meant before. This is the one for region swaps on busy scenes, and it's the one I'd start with if you're porting an existing workflow.

    curve only applies to edit strength, so if you're in denoise mode and the midtones look off, the slider you're reaching for isn't doing anything.

    Cost, stated plainly

    inner_steps + 1 model calls per step, so 3× at the default. That's the price of the smooth handover and it's not hidden. On a 20-second generation that's a minute. Whether it's worth it depends entirely on whether you had seams; if your Differential Diffusion output was clean, this won't make it cleaner.

    Pixels at exactly 0 - a protect_mask, or Region Latent background = 0 - come back as the source latent, same as an ordinary inpaint. It works with any model, with or without Regions Apply patching the model, so it isn't gated to Krea 2 the way the LoRA routing is.

    Install

    Manager → search Nynxz → ComfyUI-NynxzNodes, or:

    comfy node install comfyui-nynxz-nodes
    

    From source:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Nynxz/ComfyUI-NynxzNodes
    cd ComfyUI-NynxzNodes
    pnpm install && pnpm build
    

    Restart. No models, no extra Python dependencies - it's comfy.samplers.Sampler with torch in it.

    Troubleshooting

    The run takes forever. That's inner_steps. Drop to 1 and see how much you lose; if the answer is "nothing visible", stay there.

    Everything got redrawn, including the parts I wanted kept. You're in edit strength mode with a mask that has non-zero background values. Either switch to denoise, or make the background exactly 0 so the pixel comes back as the source.

    Mask edges still show. Check warm_start is on, and raise tether. The whole claim of the node is a seam-free handover, so a hard edge usually means the mask itself is nearly binary - in which case a hard handover is what you asked for, and a small blur on the mask upstream will help more than any sampler setting.

    It ignores my Differential Diffusion node. By design. Remove DD if you're using this; it's one or the other, not a stack.

    Experimental is the right label for this one. It's a research paper's method wrapped as a sampler, and the defaults are the paper's rather than tuned for ComfyUI habits - expect to spend a run or two finding your tether value.

    CategoryNynxz/Regions

    Inputs (6)

    NameTypeDefaultDescription
    inner_stepsINT21–8Langevin updates per step, one model call each. 2 is the paper's sweet spot; past 3 buys little.
    step_sizeFLOAT0.200.01–2How far each update moves, in units of the noise level. 0.2 is the paper's; higher settles faster and noisier.
    tetherFLOAT5.00–20How hard low-mask pixels are held to the source, like a guidance scale for the source image. Higher keeps structure, lower lets weak mask values edit more.
    curveFLOAT2.00.5–8How mask values map to freedom. 2 makes the edit roughly linear in the mask value; higher makes middle values edit more.
    warm_startBOOLEANtrueStart each step's loop from the noised source wherever the tether is strongest. Speeds settling; without it two inner steps can leave noise at mask edges.
    mask_meansoptCOMBOedit strengthedit strength: the paper's reading — edits rise evenly with the mask, so middle values rebuild most of a region and a low background still gets redrawn. denoise: Differential Diffusion's reading — each pixel is held to the source until the noise level DD would start it at, then handed over gradually. Use denoise for region swaps on busy scenes. `curve` applies to edit strength only.

    Outputs (1)

    NameTypeDescription
    samplerSAMPLER—