Nodes/ComfyUI_agilly1989_motorway/LatentComposite_motorway_edition
ComfyUI Node

LatentComposite_motorway_edition

Stitch latents together in the pipe (outpainting's building block)

By agilly1989Β·Created 2 years agoΒ·Updated about a year agoΒ· 7
LatentComposite_motorway_edition
  • MOTORWAY πŸšŒπŸ’¨
  • MOTORWAY πŸšŒπŸ’¨
β—„INPUT_samples_to_keysamples_toβ–Ί
β—„INPUT_samples_from_keysamples_fromβ–Ί
β—„x0β–Ί
β—„y0β–Ί
β—„feather0β–Ί
β—„OUTPUT_LATENT_keyLATENTβ–Ί

LatentComposite_motorway_edition wraps core's LatentComposite: it pastes one latent onto another at a given (x, y) position, with optional feathering on the seam. The motorway edition reads both latents from pipe keys and writes the result back to a key, instead of running three cables.

What compositing in latent space buys you

This is the node behind outpainting and region-patching workflows that never leave latent space. You generate a canvas latent and a separately-generated patch latent, then LatentComposite places the patch onto the canvas at coordinates - and because it happens before VAE decode and before sampling, the seam gets blended by the diffusion process rather than being a visible paste-line in pixels. It's the same idea as ImageComposite but on the compressed representation, which is why you use it when you plan to sample the composite again (e.g. to blend an outpainted region back into the original image with a follow-up low-denoise pass).

Three things you actually set:

  • x / y (both step 8, default 0) - where the source latent lands on the destination, in latent-space units. ComfyUI latents are 8x smaller per side than pixels, and the step of 8 reflects that: these are latent coordinates, not pixel coordinates. A 512px offset in the image is 64 here.
  • feather (default 0) - pixels of blending at the edge of the paste. Zero means a hard cut; a bit of feather stops the seam from being a straight line your eye catches.

The inputs are INPUT_samples_to_key (the canvas you're pasting onto, default "samples_to") and INPUT_samples_from_key (the piece you're moving, default "samples_from"); the output is OUTPUT_LATENT_key (default "LATENT"). Direction matters - samples_from goes onto samples_to, not the other way - and it's the most common swap people make when they first wire this up.

Motorway notes

All three inputs are key fields, so every value must exist in the pipe before this node runs; a missing key throws the pack's signature 'MotorwayClass' object has no attribute 'hash_' error. The only output socket is MOTORWAY πŸšŒπŸ’¨; read the composited latent out via a Motorway AxB ramp when you want to sample or decode it.

Install and caveats

cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway

Restart ComfyUI, or install via ComfyUI Manager. No pip deps or model files - pure tensor placement.

And the standing reality check: this pack is a one-developer beta, and right now it's mid-refactor - the current HEAD comments out the _motorway_edition registration, so a fresh clone may not even load the node. The README's "IF THINGS BREAK ITS BECAUSE I BROKE IT" is the author's own disclaimer, not a joke. If compositing latents is all you need and you're not married to a pipe workflow, the stock LatentComposite gives you the identical result with sockets - the wrapper only pays off once your graph is already routing everything through keys.

Categoryagilly1989 Nodes/Motorway-ed/latent

Inputs (7)

NameTypeDefaultDescription
MOTORWAY πŸšŒπŸ’¨MOTORWAY πŸšŒπŸ’¨β€”
INPUT_samples_to_keySTRINGsamples_toβ€”
INPUT_samples_from_keySTRINGsamples_fromβ€”
xINT00–16384β€”
yINT00–16384β€”
featherINT00–16384β€”
OUTPUT_LATENT_keySTRINGLATENTβ€”

Outputs (1)

NameTypeDescription
MOTORWAY πŸšŒπŸ’¨MOTORWAY πŸšŒπŸ’¨β€”