Nodes/GlitchNodes/PixelFloat | GlitchNodes
ComfyUI Node

PixelFloat | GlitchNodes

Optical flow that makes pixels fall

By pxl-pshr·Created 2 years ago·Updated 3 months ago· 73
PixelFloat | GlitchNodes
  • frames
  • image
gravity_strength-10.0
block_size4
auto_block_sizefalse
min_blocks32
max_blocks128
flow_scale0.25
flow_levels5
flow_iterations3
motion_threshold0.5
interpolation_factor0.5

PixelFloat is the animation node of the pack: it takes a batch of frames and makes the image's pixels fall. Using real optical flow, it estimates how each region moves between frames, then applies a downward gravity that drags slower-moving blocks down - like pixel raindrops or a waterfall made of your image. It's the kind of effect that looks like custom VFX work but is actually a single node between your frames and your encoder.

The mechanism is the most "computer vision" thing in GlitchNodes. It runs OpenCV's calcOpticalFlowFarneback on consecutive frame pairs (a pyramidal Lucas-Kanade-style flow estimator, so flow_scale, flow_levels, and flow_iterations control the pyramid - smaller scales, more levels, more iterations = finer flow). It blocks the flow field into block_size squares, computes each block's motion, and then gravity_strength (negative only, -50 to 0) biases those motion vectors downward. Blocks that are moving enough (above motion_threshold) get carried by gravity; interpolation_factor smooths the transition so blocks don't teleport. The warped frame is composited via cv2.remap with reflection borders, which is why the edges hold together instead of tearing.

The inputs that matter

  • gravity_strength (-50 to 0, default -10) - the whole effect. More negative = heavier fall. -10 is subtle, -40 is a pixel avalanche.
  • motion_threshold (0.1–5, default 0.5) - how much motion a block needs before gravity grabs it. Raise it to keep static regions frozen.
  • interpolation_factor (0–1, default 0.5) - motion smoothing. Lower = sharper pixel drops, higher = smoother smearing.
  • block_size (4–64, default 4) - size of the motion-analysis blocks. Bigger blocks = chunkier, more visible pixel blocks; auto_block_size lets the node pick based on min_blocks/max_blocks.
  • flow_scale / flow_levels / flow_iterations - optical flow quality. Defaults (0.25 / 5 / 3) are fine; raise iterations for less noisy flow on grainy footage.

Input is named frames (an IMAGE batch - consecutive frames in order), output is image (IMAGE) → VideoCombine or PreviewImage.

Installing it

Part of GlitchNodes:

cd ComfyUI/custom_nodes
git clone https://github.com/pxl-pshr/GlitchNodes
# restart ComfyUI

or ComfyUI Manager → Install Custom Nodes → search "GlitchNodes". This node leans hard on opencv-python and scipy, both in the pack's requirements - Manager installs them. No model downloads.

Gotchas

PixelFloat is genuinely slow, because Farneback optical flow on every frame pair plus remap is heavy CPU/GPU work - test on 10 frames before committing to a long sequence. Also, it needs real consecutive frames: feed it a batch of unrelated stills and the flow estimate is garbage, so you'll get twitchy noise instead of falling pixels. If the fall looks juddery, raise flow_iterations or block_size before you raise gravity. And take the pack's WIP warning seriously - like the others, "highly experimental and may break or even error," and optical-flow errors (odd frame shapes, tiny frames) surface as runtime errors. Keep frame dimensions consistent.

CategoryGlitchNodes

Inputs (11)

NameTypeDefaultDescription
framesIMAGE
gravity_strengthFLOAT-10.0-50–0
block_sizeINT44–64
auto_block_sizeBOOLEANfalse
min_blocksINT3216–64
max_blocksINT12864–256
flow_scaleFLOAT0.250.1–0.9
flow_levelsINT51–8
flow_iterationsINT31–10
motion_thresholdFLOAT0.50.1–5
interpolation_factorFLOAT0.50–1

Outputs (1)

NameTypeDescription
imageIMAGE