Nodes/ComfyUI-latent-ops/LatentOperationInterpolate
ComfyUI Node

LatentOperationInterpolate

Blend two latents, the way morphing was always meant to work

By hnmr293·Created about a year ago·Updated about a year ago· 2
LatentOperationInterpolate
  • latent_a
  • latent_b
  • latent
alpha0.5000

The one node in this pack that just works, and the one you'll actually show your friends. LatentOperationInterpolate blends two latents together with a single alpha slider: 0 gives you latent A, 1 gives you latent B, 0.5 splits the difference. No VAE round-trip, no image compositing - the morph happens in latent space, where the model's own vocabulary lives, so the blend tends to feel like a real transition rather than a crossfade of two pictures.

It's the direct-LATENT exception to this pack's usual deferred-op pattern: no op output, no Apply node required. Feed it two latents, get a latent out, wire it to the sampler or VAE Decode. It's from hnmr293's ComfyUI-latent-ops pack (the same author as sd-webui-cutoff and llul).

How it works

The author's tooltip gives the whole math: z = (1-alpha) * a + alpha * b. Elementwise weighted sum - at alpha 0.5 each side contributes half its value to every position. Because it's a scalar-weighted addition, the two input latents must be broadcast-compatible: same spatial dims is the safe rule, and matching channel counts is mandatory (a 4-channel SD latent and a 16-channel Flux latent will not blend). Extrapolation works too - alpha below 0 or above 1 pushes past the endpoints, which is sometimes exactly the "more style" nudge you want, though it can drift into weird territory.

What matters

  • latent_a - the starting latent (alpha 0 endpoint).
  • latent_b - the ending latent (alpha 1 endpoint).
  • alpha - FLOAT, default 0.5, range -10000 to 10000, step 0.0001. The blend weight.
  • latent - the only output, a real LATENT. Wire it to a sampler or VAE Decode directly.

Installing it

Same pack, same trivial install: no requirements.txt, no model files, pure torch. ComfyUI Manager → search "ComfyUI-latent-ops" → install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/hnmr293/ComfyUI-latent-ops

Restart ComfyUI; it's under hnmr/latent_ops.

Troubleshooting

The usual error is a shape mismatch - two latents from different resolutions or channel counts won't blend; match the VAE-encoded sizes first (or use the pack's Reshape if you know what you're doing). If the blend looks muddy at 0.5, that's latent-space math, not a bug: half-and-half of two strong latents can land in an under-sampled region of the model's distribution, so nudge alpha toward one end or run a denoise pass after. And if you want a guided blend rather than a global one, that's where you'd chain this into the pack's instance norm trick - normalize both sides first so intensity differences don't dominate the mix.

Categoryhnmr/latent_ops

Inputs (3)

NameTypeDefaultDescription
latent_aLATENT
latent_bLATENT
alphaFLOAT0.5000-10000–10000z = (1-alpha) * a + alpha * b

Outputs (1)

NameTypeDescription
latentLATENT