Nodes/WAS Affine/Affine Smooth Region Options
ComfyUI Node

Affine Smooth Region Options

Affine's smooth-region mask

By WASasquatch·Created about a year ago·Updated 5 months ago· 5
Affine Smooth Region Options
    • noise_options
    content_window7

    WASSmoothRegionOptions tunes Affine's smooth_region pattern, and it's the one content-aware mask in the pack that beginners tend to underrate until they see a burnt-out sky. The pattern isn't procedural geometry or noise - it looks at the latent itself and finds the low-detail areas: skies, walls, empty backgrounds, smooth skin. Then the affine transform only touches those flat regions.

    That's the opposite job of detail_region (high-texture areas), and it's exactly what you want when a speed LoRA or an aggressive CFG has blown out contrast. You get the taming applied where the burn lives - the featureless expanse - while the textured subject in the foreground keeps its structure. The Affine README calls smooth_region out for "skies," and honestly that's 90% of the use case right there: flatten a gradient banding mess or knock back a blown highlight without sliding a mask over the whole image.

    How it works

    The mask comes from a local variance analysis of the latent. The single input, content_window (default 7, range 3–63), sets the odd-sized kernel used for that analysis - the neighborhood each pixel's variance is measured over. A small window (5–7) catches only very local flatness; a large window (31+) treats broader swaths as "smooth," which catches larger soft regions but starts to classify gentle gradients as flat too.

    Variance is the right statistic for this. High local variance = texture/edges = detail. Low local variance = flat = smooth region. The pattern marks the low-variance pixels, and the affine step applies scale/bias there. The whole node is one integer, which keeps it honest: you're tuning "how much neighborhood counts as flat enough to include."

    It outputs the standard noise_options DICT - connect it to the noise_options input on Latent Affine, the KSampler Affine family, or the Ultimate Affine KSampler nodes, and set pattern to smooth_region. As with every options node here, noise_options layers over the base options dict (from WASLatentAffineCommonOptions), overriding shared keys.

    Installing it

    Part of WAS Affine (WASasquatch/was_affine). Install via Manager by searching "WAS Affine," or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/WASasquatch/was_affine.git
    

    Then restart ComfyUI. No model downloads, no UltimateSDUpscale requirement, and the dependency list is just torch/numpy (matplotlib ships in requirements.txt for the schedule plots).

    Where it bites

    • You must be inside a sampling pass. smooth_region is content-aware - the mask is computed from the latent being processed, not from your source image. The node does nothing unless the consuming affine node is actually running mid-sampling, which is why the integrated samplers (KSampler Affine and the Ultimate variants) are the natural home for it.
    • The default 7 is a decent start. If the pattern is missing broad soft areas, raise the window; if it's swallowing medium-textured ground, lower it.
    • Pair it with a low scale (<1, darkening) to knock back blown highlights, or a modest positive scale for subtle flat-region brightening. Latent space is sensitive - the README warns 0.95 is already a strong move, so don't go wild.

    One knob, one job: find the flat stuff, let Affine touch only that. Underrated pattern for cleaning up the classic over-burned output of speed LoRAs.

    Categorylatent/adjust

    Inputs (1)

    NameTypeDefaultDescription
    content_windowINT73–63Odd kernel size for local variance used in smooth regions.

    Outputs (1)

    NameTypeDescription
    noise_optionsDICT