vlo Latent Composite Masked
Paste latent patches back without re-rendering the whole frame
- destination
- source
- LATENT
The dirty secret of "fixing" a video frame is that you don't regenerate the whole frame - you generate a patch and paste it back over the original, so everything you didn't touch stays bit-identical. That paste step, done in latent space, is exactly what vlo Latent Composite Masked does.
It's the "composite" half of patch-based inpainting, and it's load-bearing in vlo, the video editor this pack serves. vlo's whole approach to salvaging an almost-right generation is to mask a region, re-render just that region at quality, then stitch the patch back into the source latent. The node takes a source latent (your fresh patch), a destination latent (the original clip), and - here's the trick - uses the destination's existing noise_mask as the paste stencil. No extra mask wiring; the mask that defined the patch is the compositing mask.
How it works
Plain lerp in latent space: output = source × mask + destination × (1 - mask). Wherever the mask is 1, the patch wins; wherever it's 0, the original holds. Two toggles shape the result:
- force_binary_mask (default false) - thresholds the mask at 0.5 before compositing. Leave it off and you get continuous blending at the edges (soft, painterly, good for stills). Flip it on and you get crisp hard mattes, which is what you want when the region moves - a feathered mask that drifts between frames is how you get ghosting and smears in video.
- clear_mask (default false) - pops the
noise_maskoff the output after compositing. If you're pasting into a latent that's about to be sampled again, leaving the mask on will steer the next sampling pass into re-denoising that region. Clear it when the composite is the final answer.
Inputs are destination and source (both LATENT); output is the composited LATENT.
Where people get burned
The biggest trap is silent: if the destination has no noise_mask at all, the node just returns the destination unchanged. No error, no warning - which is why the tooltip says the destination "should have an existing noise_mask." Build your pipeline so the mask is always present before this node runs.
The second trap is shapes. The source, destination, and mask must be broadcast-compatible, and the mask needs to be preshaped for the latent. If they're not, you get a RuntimeError with a message that names all three shapes - which is ComfyUI's way of saying "your patch resolution and your mask resolution disagree." Encode the patch at the same latent resolution as the destination.
Install
Part of the ComfyUI-vlo pack, so:
cd ComfyUI/custom_nodes
git clone https://github.com/PxTicks/ComfyUI-vlo.git
Restart ComfyUI (or install via ComfyUI Manager as "ComfyUI-vlo"). No models, no extra pip deps - it's a torch multiply and a mask threshold.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| destination | LATENT | The destination latent. Should have an existing noise_mask. | |
| source | LATENT | The source latent patches to composite into the destination. | |
| clear_mask | BOOLEAN | false | If true, removes the noise_mask from the output latent after compositing. |
| force_binary_mask | BOOLEAN | false | If true, applies a 0.5 threshold to the mask to prevent continuous blending at the edges. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |