Nodes/DOGMA Nodes/DOGMA v39 Safe Conservative Blend
ComfyUI Node

DOGMA v39 Safe Conservative Blend

The version that throws the failed tile away

By axior·Created 4 months ago·Updated 3 days ago· 1
DOGMA v39 Safe Conservative Blend
  • edited
  • original
  • image
  • info
max_alpha0.55

Batching a detailing pass is a bet that every tile will come back usable. Most of the time it does, and the times it doesn't are memorable in a specific way: a black rectangle where a building was, or a tile that came back as a completely different photograph. That's not a blend problem, it's a failed sample, and the last thing you want is a blend node smearing a dead tile into your master at 40% opacity.

This node is the v37 blend plus a veto. The class is named ...V381 and the display says v39, which is the usual state of naming in this pack.

Same policy, plus a bail-out

For each edited/original pair it computes delta, the mean absolute difference, and then:

if (edited_mean < 0.01 and original_mean > 0.03) or delta > 0.24:
    alpha = 0.0
else:
    alpha = clamp(0.060 / delta, 0.16, max_alpha)

Alpha 0.0 means the original region is written through untouched. Not blended at 1%, not mostly-original: the original. Two conditions trigger it, and both are worth understanding because they're the two ways a tile fails silently.

The first is a near-black result. If the edited tile's mean luminance is under 0.01 while the original's is over 0.03, the tile is essentially black and the original was not - a failed decode, a VRAM hiccup, a sampler that got a zeroed latent. That's the black-rectangle failure and it's the one you'd otherwise only catch by scrolling through a contact sheet.

The second is a huge delta. Above 0.24 mean absolute difference the tile is no longer a refinement of anything; it's a different image. Rather than averaging one photograph into another, it's discarded.

Otherwise the rule from v37 holds, with the floor nudged from 0.18 to 0.16: the amount of change is roughly held constant, and a tile that barely differs gets the largest blend, up to max_alpha (default 0.55).

Inputs, outputs, plumbing

  • edited (IMAGE) and original (IMAGE) - list inputs. The node coerces single images into single-element lists for you (the v37 sibling didn't), so it's a bit more forgiving to wire.
  • max_alpha (FLOAT, default 0.55, 0–1, step 0.05) - the ceiling on the blend for low-delta tiles.
  • Output image (IMAGE, list) and info (STRING) - per-tile, 1:d=0.184/a=0.33, and a tile that got vetoed shows a=0.00.

Original tiles are bicubic-resampled to the edited tile's size when they differ. A shorter original list reuses its final entry, which is how you blend a batch of crops against one master frame without duplicating it.

Install

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

ComfyUI Manager → DOGMA Nodes, or comfy node install comfyui-dogma-nodes. No dependency step at all - requirements.txt in the repo is one comment line, pyproject.toml declares dependencies = [], and the node is tensor arithmetic on torch. No models. MIT licensed.

Where people get burned

The veto fails open-ish, silently. A vetoed tile is an unchanged region, which looks exactly like a region that didn't need work. The only signal is a=0.00 in the info string. On a long run, parse that string or you'll conclude "the pass did nothing there" when what actually happened is "the pass produced garbage and we bailed."

delta > 0.24 can fire on a legitimate big edit. This is the honest trade. If you asked for a genuinely large change - object removal, a reconstruction from a black blob - a strong result may exceed the threshold and get thrown away. The blend is tuned for refinement, not for invention, and the pack's own answer to invention is a masked stitch with the generated pixels present at full strength.

A black tile is a symptom, not the disease. The bail-out protects your master, and it also hides the fact that tile 7 of 30 failed. Whatever caused it - VRAM pressure, a quantized checkpoint behaving badly on one tile, a sampler mismatch - will do it again on the next run. If a=0.00 shows up regularly, look at the pipeline rather than at this node.

And remember what this node is for. It's a batch-safety net that keeps an unattended run from making the image worse than the source. If you're hand-checking tiles, a mask-driven stitch gives you a straight answer where this gives you a conservative average.

CategoryDOGMA/Semantic Detailer

Inputs (3)

NameTypeDefaultDescription
editedIMAGE
originalIMAGE
max_alphaFLOAT0.550–1

Outputs (2)

NameTypeDescription
imageIMAGE
infoSTRING