BSZ Latent Gradient
Blend two latents along a sine, circle, or ring pattern
- a
- b
- LATENT
BSZ Latent Gradient is the pack's crossfader: it takes two latents and blends them together along a pattern - a banded sine, a honeycomb of circles, rings - instead of a flat left-to-right wipe. Wire up "latent from seed A" and "latent from seed B," pick a pattern, and get a latent that transitions between the two in the shape you chose.
Why you'd reach for it
Regional and gradient blending is normally a pixel-space game - you'd decode both images, build a mask, and blend. Doing it in latent space is cheaper and keeps the result a single coherent latent that you can keep sampling, refining, or feeding through the pack's principled nodes. People use it for smooth two-subject comps, palette transitions, and generally messing around with what "halfway between these two generations" means when the halfway line is a circle.
Inputs that matter
a/b- the two latents. They must have identical shapes; the node raises an error otherwise. The output takes its metadata froma.pattern- the shape of the blend:sine(typical banded gradient),sine2(same but the y-axis flipped),circle(circles packed honeycomb-style),squircle(squircle-ish shapes on a grid),rings(concentric rings).xfrequency/yfrequency- pattern repetitions along each axis. With xfrequency 2 and yfrequency 0 you get a simple horizontal banded gradient.xoffset/yoffset- where the pattern starts.invert- flips which latent is where; still takes its parameters froma.
Output: one LATENT.
How it works
It builds a per-pixel factor tensor from trig functions over normalized coordinates - sine waves for the banded patterns, sine-of-sine for circles and rings - then interpolates a and b by that factor. The README's flavor text is worth quoting: rings are "circle but recursive instead of tiling." The interpolation is a true mix, not a hard mask, so you get soft transitions rather than a cut.
Install & gotchas
cd ComfyUI/custom_nodes
git clone https://github.com/Beinsezii/bsz-cui-extras
restart, or install via ComfyUI Manager. Pure Python, no dependencies.
Two things to know before you lean on it. First, the shape check is strict - a 1024×1024 latent and a 512×512 latent will throw, so size both sources the same way first. Second, the frequency/offset knobs are abstract; the pattern can come out with the transition exactly where you didn't want it, and invert is your first fix when the blend is backwards. Start with sine, xfrequency 1–2, yfrequency 0, and get a feel for the offsets before exploring circles and rings.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| a | LATENT | — | |
| b | LATENT | — | |
| pattern | COMBO | 5 options: sine, sine2, circle, squircle, rings | |
| xfrequency | FLOAT | 2.000–10 | — |
| yfrequency | FLOAT | 0.000–10 | — |
| xoffset | FLOAT | 0.00-1–1 | — |
| yoffset | FLOAT | 0.00-1–1 | — |
| invert | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |