Nodes/ComfyUI-FLATTEN/Create Flow Noise
ComfyUI Node

Create Flow Noise

Noise that flows along your video's motion, not static snow

By logtd·Created 3 years ago·Updated 2 years ago· 114
Create Flow Noise
  • latent
  • trajectories
  • noise
add_noise_to_latentfalse

The noise with a memory

Every diffusion run starts from noise, and normally that noise is boring: every pixel gets an independent random value. This node makes noise that isn't independent - it's correlated along the motion in your video. Take a pixel in frame one, follow the optical flow to where it lands in frame two, and the noise stays the same value there. That's "flow noise," and it's the whole reason FLATTEN's attention mechanism works when you bolt it onto a model with Apply Flatten Attention.

You reach for this node in one specific situation: when you want to use FLATTEN's optical-flow attention outside the full unsample/re-sample pipeline, or when you want to replace the initial latent noise in a sampling step with something the flow-guided attention actually understands. The README positions it as a replacement for the "normal noise from a traditional KSampler" - feed this node's output in where you'd otherwise start the denoise.

How it works

Give it a latent and the trajectories from Sample Trajectories, and it walks the flow field. Starting from a base random tensor, it propagates a single value along each trajectory path, marking pixels as visited so the same motion chain gets the same noise value. The result is a LATENT where temporally-connected pixels share noise - visually, the snowflakes travel with the movement instead of flickering independently frame to frame. Under the hood the noise is generated by a closure that creates the flow-driven tensor on the fly, exactly what the sampler expects.

The inputs

Only three:

  • latent - the latent you'd be adding noise to anyway. Must match the resolution of the trajectories.
  • trajectories - the TRAJECTORY from Sample Trajectories in this pack.
  • add_noise_to_latent - a boolean, default false. When true, the flow noise is added onto the input latent and the result is returned as a combined latent. When false (the default), you get just the noise, which you then add yourself or feed to a sampler that takes initial noise.

The single output is named noise and is a LATENT.

Gotchas

The obvious one: if add_noise_to_latent is off, this node returns pure noise, not a latent you can decode. That's not a bug - it's the intended contract, and it's why the output is literally named noise. Pair it with the attention node and don't double-add noise: if a sampler in your graph already injects ordinary noise, flow noise doesn't always play nice, which is the README's warning about FLATTEN attention generally. And keep the trajectory resolution aligned with the latent, or the flow lookup misses its targets entirely.

Installing

Search ComfyUI-FLATTEN in ComfyUI Manager, or:

cd ComfyUI/custom_nodes
git clone https://github.com/logtd/ComfyUI-FLATTEN

Restart ComfyUI after. The pack ships with no extra Python dependencies - requirements.txt is empty - and the RAFT optical flow it depends on comes bundled with torchvision, so a normal ComfyUI install already has everything. All you need on top is an SD 1.5 checkpoint.

Categoryflatten

Inputs (3)

NameTypeDefaultDescription
latentLATENT
trajectoriesTRAJECTORY
add_noise_to_latentBOOLEANfalse

Outputs (1)

NameTypeDescription
noiseLATENT