ComfyUI Node

Region Latent

Encode the source, grade the denoise per region, and keep the background alive

By Nynxz·Created 10 months ago·Updated a day ago· 0
Region Latent
  • vae
  • image
  • regions
  • latent
  • denoise_mask
background0.05
flatten0.00

The Regions group handles the which LoRA fires where problem. Region Latent from ComfyUI-NynxzNodes handles the how much gets redrawn problem on edit jobs: it encodes your source image, reads each region's denoise value, and builds one graded mask that lets the sampler rebuild your characters while the background mostly survives. It's the node that turns "regional LoRA gating" into "regional editing" - without it, you've gated who draws where, but everything in the image is equally fair game for redraw.

The canonical layout, straight from the code's own docstring:

Regions from Masks → Region LoRAs → Regions Apply → MODEL
                                                    ├→ Differential Diffusion → KSampler (denoise 1.0)
Regions … → Region Denoise → Region Latent → LATENT ┘

What you set

  • image - the source image being remixed, the one your masks were segmented from.
  • vae - the VAE that encodes it (same one the model uses).
  • regions - the region set, complete with each region's denoise and any Region Denoise overrides.
  • background (default 0.05) - the denoise for everything no region claims. Low keeps the original background, lighting and framing; 0 freezes it exactly, which the tooltip warns can leave a visible seam where a rebuilt character meets it - a little movement helps the character and background agree.
  • flatten (default 0) - blends each region toward its own mean colour before sampling, so what survives a low-denoise pass is a correctly-placed blob rather than the old character's face. Most useful in the 0.6–0.8 denoise band; pointless at 1.0 where the latent gets erased anyway.

Two outputs: the latent (the encoded source with the graded mask already attached as its noise mask) and denoise_mask (the same mask, for previewing - you do not need to route it back through a Set Latent Noise Mask node; it's already on the latent).

The dependency that surprises everyone

A graded per-pixel denoise mask only means something if the model can read it as such. Core's Differential Diffusion node - comfy_extras/nodes_differential_diffusion.py - is what interprets a graded mask as per-pixel start noise. So the model must pass through Differential Diffusion between Regions Apply and the KSampler, and the sampler should run at denoise 1.0 so the noise mask is the thing deciding how much each pixel moves. Wire Region Latent into a sampler that never got Differential Diffusion and your careful denoise gradations collapse toward binary behavior - regions either fully redraw or don't, and the seams come back.

Install & caveats

In Nynxz's Custom Nodes: ComfyUI Manager → search "NynxzNodes" (registry build preferred; hand clones need pnpm install && pnpm build since web/ is gitignored), or git clone https://github.com/Nynxz/ComfyUI-NynxzNodes. No pip dependencies. The Regions group is Krea 2 only and experimental - Regions Apply refuses other architectures loudly. And this is an editing node: if you're generating from pure noise with no source image, you don't need it at all.

CategoryNynxz/Regions

Inputs (5)

NameTypeDefaultDescription
vaeVAE
imageIMAGEThe source image being remixed — the one the masks were segmented from.
regionsNYNXZ_REGIONS
backgroundFLOAT0.050–1Denoise for everything no region claims. Low keeps the original background, lighting and framing. 0 freezes it exactly, which can leave a visible seam where a rebuilt character meets it — a little movement helps them agree.
flattenFLOAT0.000–1Blend each region toward its own mean colour before sampling, so what survives the denoise is a correctly-placed blob rather than the old character's face. Scaled by each region's denoise. Most useful in the 0.6-0.8 denoise band; pointless at 1.0, where the latent is erased anyway.

Outputs (2)

NameTypeDescription
latentLATENTThe encoded source with the graded mask attached as its noise mask.
denoise_maskMASKThe same graded mask, for previewing. Already on the latent — you do not need to wire it back through Set Latent Noise Mask.