Nodes/DOGMA Nodes/DOGMA v35.1 Latent By Denoise
ComfyUI Node

DOGMA v35.1 Latent By Denoise

DOGMA v35.1 Latent By Denoise

By axior·Created 4 months ago·Updated 3 days ago· 1
DOGMA v35.1 Latent By Denoise
  • source_latent
  • empty_latent
  • latent
  • info
denoise1.00

Denoise at 1.0 and you're generating from scratch. Denoise at 0.5 and you're doing image-to-image. Those are two different graphs with two different latent sources, and this node picks the right one for you from a single number.

Three inputs, one if-statement. It's the kind of tiny node that a 40-node pipeline needs somewhere, and if your workflow keeps a full-noise path and an img2img path side by side, this replaces the branch.

What it is

In ComfyUI, "img2img" is not a mode - it's a consequence of what you plug into the sampler and how much noise you add back. Feed a sampler an empty latent with denoise 1.0 and you get a fresh generation. Feed it a latent encoded from your source image with denoise 0.4 and you get a partial re-render that keeps the source's structure. In a masking pipeline both cases are legitimate and both want the same set of downstream nodes.

Hard-wiring both is the usual solution and it's a poor one: two latent sources, two sampler paths, and a graph where you have to remember to mute the right one. This node collapses the choice into the denoise value, so flipping between full-noise regeneration and true source-latent img2img is one widget.

How it works

The logic is not subtle, and that's a feature. If denoise is 0.999 or above, it returns empty_latent and reports "denoise 1.00: original v35 empty-latent full-noise." Below that, it returns source_latent and reports "true source-latent img2img."

The 0.999 threshold rather than an exact 1.0 is the practical bit, and it matches how these values behave in the UI: a float widget at step 0.01 arrives as 1.0, but values nudged by a scheduler or a fan-out node can land at 0.9999, and treating those as an img2img request gives you a near-full re-render of your own source, which is the worst of both worlds. The node rounds that decision in favour of full noise.

There's a subtlety about why this is a node rather than a switch: the sampler's latent input needs a real LATENT with the right channel count and geometry, and both inputs here are proper latents from the same stack - one from an encode of your source, one empty and built for the same resolution. So the choice is between two valid tensors and nothing downstream has to know which arrived.

Inputs and outputs

Three inputs. source_latent (LATENT) - a VAE encode of the image you're refining (or the crop you're refining). empty_latent (LATENT) - the empty latent sized to your generation, the same one you'd hand a txt2img sampler. denoise (FLOAT, default 1.0, range 0.05–1.0, step 0.01).

Two outputs. latent (LATENT) - whichever it selected. info (STRING) - a sentence naming the mode and the denoise value it saw. Wire info to a preview when you're tuning; it's the difference between "the sampler ignored my denoise" and "the sampler correctly went full-noise because the value rounded up."

Install

ComfyUI Manager → search DOGMA Nodes (publisher axior), install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/axior/ComfyUI-DOGMA-Nodes
# restart ComfyUI

No external dependencies - requirements.txt is a one-line comment saying so - and no weights in the repo.

Common issues

The thing that catches people is the combine of this node with a masked workflow. Having a source latent is not the same as having an inpaint conditioning setup. The community recipe for making an edit model do true masked inpainting is to use InpaintModelConditioning rather than an empty latent, and to feed the inpaint image as a reference latent so the model blends with its surroundings. Feeding a plain encoded source latent to a sampler with denoise 0.4 is masked img2img, which is a related but different thing - less contextual, more literal, and it's what you want when the repair should stay close to the source pixels.

So: this node selects the latent, it doesn't configure conditioning. If your results have a seam, the seam is a mask and conditioning problem, not a latent-selection problem.

Second, and less obvious: the two latents need to agree on geometry. An empty latent built for 1024x1024 fed against a source latent from an 8000px frame will not error at selection time - it'll error in the sampler, or worse, sample something at the wrong scale. Encode your source at the resolution you're actually generating at.

CategoryDOGMA/Semantic Detailer

Inputs (3)

NameTypeDefaultDescription
source_latentLATENT
empty_latentLATENT
denoiseFLOAT1.000.05–1

Outputs (2)

NameTypeDescription
latentLATENT
infoSTRING