DOGMA v36 Source + Novel Edge Gate
Vetoing the bus the model invented
- generated
- source
- image
- evidence_weight
- info
The v25 gate asks one question: how much real structure did the source have here? This one asks a second, sharper question - is the generated image claiming structure the source never had? That's the failure everyone actually notices, because a generative upscale that adds texture to grass is forgivable and one that adds a pedestrian to an empty road is not.
Two signals, not one
It computes the same support map as v25: luminance gradient plus local deviation from a 7×7 mean, measured on a downsampled proxy of the source, normalised between low_threshold and high_threshold, grown by support_grow, smoothed, giving a 0–1 map of "there was something here."
Then it adds novelty, from the generated proxy's gradient:
novelty = clamp((grad_generated - grad_source * 2.2 - 0.012) / 0.060)
flat_change = clamp((|generated - source| - 0.035) / 0.12)
veto = max(novelty, flat_change) * (1 - support)^1.35
alpha = (floor + (1 - floor) * support) * (1 - 0.97 * veto)
The (1 - support)^1.35 term is the whole design. Novel edges in a region that already had evidence are cheap - the model is sharpening something real. Novel edges in a region with no evidence get multiplied up toward a full veto, and 0.97 means a full veto drops the generated pixels to 3% of their weight. flat_change catches the blunter version: a big colour or luminance change in a flat region, which is what a model does when it decides the sky should have clouds.
Default flat_generated_weight drops from v25's 0.10 to 0.06, and the proxy goes up to 384px - a slightly more sensitive gate analysed at higher resolution, which costs more compute than v25 and still nothing next to a sampling pass.
Inputs and outputs
generated (IMAGE), source (IMAGE), flat_generated_weight (default 0.06, 0–0.8), low_threshold (0.009), high_threshold (0.040), proxy_long_side (384, 96–768, step 32), support_grow (4, 0–16).
Outputs image (IMAGE), evidence_weight (MASK) - now the post-veto weight, so it goes near zero exactly where the gate said no - and info (STRING), which reports three numbers: the proxy size, the mean generated weight, and the mean veto. That veto mean is the single most informative number in the pack for this job. Near zero and nothing was rejected; north of 0.1 and your sampler is inventing steadily.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/axior/ComfyUI-DOGMA-Nodes
Or ComfyUI Manager → DOGMA Nodes, or comfy node install comfyui-dogma-nodes. No dependencies - requirements.txt is a comment line, pyproject.toml declares dependencies = [], and the code is torch plus comfy.utils. No model downloads, MIT licensed.
Where people get burned
It will veto legitimate reconstruction. If your source crop is genuinely damaged - a black blob where a face was - then there is no evidence there, and every generated edge is, by this node's definition, novel. The gate suppresses exactly the repair you wanted. This is not a bug; it's the honest limit of a source-comparison approach, and it's the strongest argument for the version in this same pack that runs gates inside a masked workflow where the mask, not the evidence, decides ownership.
Proxy size changes what "flat" means. At 384px, thin structure survives better than at v25's 256, so the gate is less likely to condemn a fence as empty space. Push it to 768 and you'll catch more real detail and pay proportionally more time. It's a linear cost on a cheap node.
Never gate the whole frame and expect to see it. Per-tile gating is where this belongs; running it once over a large canvas means one bad threshold decision applies everywhere. Feed it per-crop, then stitch.
Read the version trail. DOGMAEvidenceGateV381 is the successor and it's not a cosmetic bump - it adds a low-frequency structure term and a hard override that zeroes the weight outright for strong new structure in weak-support regions. Same inputs, same outputs, more willing to say no. If v36 is leaving visible invention, that's the next thing to try.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| generated | IMAGE | — | |
| source | IMAGE | — | |
| flat_generated_weight | FLOAT | 0.060–0.8 | — |
| low_threshold | FLOAT | 0.0090–0.2 | — |
| high_threshold | FLOAT | 0.0400.001–0.3 | — |
| proxy_long_side | INT | 38496–768 | — |
| support_grow | INT | 40–16 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| evidence_weight | MASK | — |
| info | STRING | — |