DOGMATiledInpaintConditioningV545
InpaintModelConditioning for 4K crops without a VAE that eats your VRAM
- positive
- negative
- vae
- pixels
- mask
- positive
- negative
- latent
Native inpainting on a 3K crop is a memory problem before it's a quality problem. ComfyUI's stock InpaintModelConditioning hands your pixels straight to the VAE, and on a big crop the VAE encode is what dies - not the sampler. This node is that same conditioning step with the encode split into tiles.
What it actually does
The whole node is InpaintModelConditioning semantics plus one substitution, and you can see it in the source: it strips pixels to RGB, squares the frame off to a multiple of 8 by centre-cropping image and mask together, then encodes two things.
- A "masked" copy where masked pixels are pushed to neutral grey -
(work - 0.5) * keep + 0.5, so the model sees nothing useful where you want it to invent. That encode becomes theconcat_latent_imageon your conditioning. - The untouched original, which becomes
latent.samples.
The tiling only kicks in for the encode: if the long side is over 1792px or the frame is above ~3.2 megapixels it calls vae.encode_tiled with your tile_size and overlap; below that it uses the plain vae.encode. Resolution is never changed - only VAE execution is tiled.
Inputs that matter
positive/negative- your conditioning pair. Both get patched withconcat_latent_imageandconcat_mask.vae- the encoder doing the work.pixels- the crop you're restoring. Images only, RGB.mask- interpolated to the pixel size first, so a mask that arrived from a differently-sized node is fine.noise_mask(default on) - attaches the mask to the latent so the sampler only denoises inside it. Turn it off and you're doing a full-frame img2img pass with inpainting conditioning, which is rarely what you want on a 4K crop.tile_size(3136) andoverlap(128) - the only two knobs here, and they exist purely to fit the encode.
Outputs are positive, negative, latent. Conditioning goes to your guider/sampler exactly like the stock node, latent to the sampler's latent input.
Install
ComfyUI Manager → search DOGMA Nodes → install, or:
cd ComfyUI/custom_nodes && git clone https://github.com/axior/ComfyUI-DOGMA-Nodes
Restart ComfyUI. No pip installs - the pack's requirements.txt is one comment line, # No external dependencies., and this file imports nothing beyond torch, comfy.node_helpers, and comfy.utils. Nothing to download; it operates on tensors you already have.
Where it bites
Check your ComfyUI is current enough to have vae.encode_tiled. Below the size threshold this node never touches it, so it can look like it works and then fail only on your first genuinely large crop.
A silently empty mask is the classic "why is nothing happening". With noise_mask on and a mask that's all zeros, you get source pixels back looking untouched. Check the mask preview upstream before blaming the sampler.
tile_size 3136 is aggressive. It's tuned for a large-VRAM box running 2K-plus crops - precisely the case this node exists for. If the encode still OOMs, drop it to 2048 and raise overlap a little; if you're on a 12GB card, the KB's memory advice applies (try default VRAM flags before reaching for quants - forcing offload you don't need has been measured slower, not faster).
Don't pair it with a low denoise and expect a rebuild. Distilled Klein at 4 steps, CFG 1 is the intended configuration in this pipeline; raising CFG to "make it obey the mask" just overcooks a guidance-distilled model. If the masked area comes back under-detailed, add steps (4→8) rather than CFG.
The honest framing: if you never sample above ~2K, you don't need this node - the core InpaintModelConditioning node does the same thing with less to misconfigure.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| vae | VAE | — | |
| pixels | IMAGE | — | |
| mask | MASK | — | |
| noise_mask | BOOLEAN | true | — |
| tile_size | INT | 3136512–4096 | — |
| overlap | INT | 12864–512 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| positive | CONDITIONING | — |
| negative | CONDITIONING | — |
| latent | LATENT | — |