ComfyUI Stat-Imp Nodes
Clean pure-torch Deforum-style nodes for ComfyUI animation loops: an exact-Deforum depth-aware 3D camera warp (pixel-identical to transform_image_3d), LAB/EMA color-coherence nodes that stop feedback-loop color drift, a vanilla-semantics cadence node, and an optical-flow estimator.
Nodes (5)
Diffuse every Nth frame, dissolve the rest
Hold your palette across 200 frames
Optical flow for smarter tweens (and when to skip it)
The depth warp that actually matches Deforum's camera math
Rolling Color Match (EMA)
ComfyUI Stat-Imp Nodes
Clean, MIT-licensed nodes for Deforum-style animation loops in ComfyUI. This release ships following nodes:
- a depth-aware 3D camera warp (exact forward port of Deforum's
transform_image_3d), - two color-coherence nodes — a fixed-anchor matcher and a rolling/EMA matcher — that stop the feedback loop's color from drifting into neon "acid",
- a cadence node (diffuse every Nth frame, dissolve the in-betweens — vanilla Deforum semantics), and
- an optical-flow estimator that feeds the cadence node for motion-aware in-betweens.
The core warp + color nodes are pure torch — no extra Python dependencies. The optical-flow node additionally uses OpenCV (DIS / Farneback backends, usually already bundled with ComfyUI) and, only for its optional RAFT backend, torchvision. See NODES.md for the full per-node reference (inputs, outputs, motion directions, tuning guidance).
Requirements
- A working ComfyUI install. If you don't have one yet, get it from the official site / repo first: https://github.com/comfy-org/comfyui (follow its install guide).
- The Deforum harness — our fork. The example workflow runs inside a Deforum
ForLoopanimation loop. It needs the harness nodes (ForLoop, ValueSchedule, Set/Get bus), and specifically our fork ofdeforum-comfy-nodes, which widens the loop's carry state (10valuesockets instead of 1) and fixes the value-schedule formula parser sosin/cosand multi-argument functions work. Install the fork: https://github.com/Statistical-Impossibility/deforum-comfy-nodes (See "Why a fork" below.) The five nodes in this pack work standalone, but the shipped example workflow assumes the fork.
Install
Clone into your ComfyUI custom-nodes folder, then restart ComfyUI and hard-refresh the browser:
cd ComfyUI/custom_nodes
git clone https://github.com/Statistical-Impossibility/comfyui-Stat-Imp-nodes
# and the harness fork the example workflow needs:
git clone https://github.com/Statistical-Impossibility/deforum-comfy-nodes
The nodes appear under the Stat-Imp / Deforum menu group.
How to use
These nodes are building blocks for a Deforum-style 3D animation loop. A ready-to-run example workflow is included:
➡️ workflows/deforum_SDXL_Distilled.json — a full depth-warp + color-coherence animation loop for SDXL Turbo / Lightning / Hyper.
Open it in ComfyUI, pick a distilled SDXL checkpoint, and queue. The embedded note explains the inputs and settings.
Why a fork (of deforum-comfy-nodes)
The upstream deforum-comfy-nodes harness is great but two things blocked this pack:
- Loop carry width. Cadence needs to thread several extra images through the animation loop
(the old anchor lineage, the captured frame-0, …). Upstream
ForLoopexposes a single carry socket; our fork widens it to 10 (value1…value10). - Value-schedule formula parser. Upstream
_sanitize_valuestripped all parentheses, so0:(cos(t))collapsed tocost→NameError, and a comma inside a value (pow(t,2)) was misread as a keyframe separator. Our fork keeps inner parens and splits keyframes only at paren-depth 0, sosin/cos/abs/pow/min/max/...work in value schedules.
Both are clean, additive changes; the fork stays drop-in compatible with upstream workflows.
Credits
This pack stands on the original Deforum work — full credit to its authors:
- Deforum (Stable Diffusion)
— the original animation engine. The camera math here is a forward port of its
transform_image_3d, and the color matcher is a clean-room reimplementation of itsmaintain_colors(helpers/colors.py). - Deforum-Comfy-Nodes — the main ComfyUI Deforum harness and node pack (ForLoop, schedules, Set/Get bus); our fork above extends it.