Difforum · Camera (advanced)
Full Deforum 2D/3D camera control, expression by expression
- params
- audio
- camera
- info
Every Deforum-style clip is really two things: a camera path and a diffusion loop. Difforum · Camera (advanced) is the full-strength camera, the one you graduate to once the presets feel like training wheels. Instead of picking "spiral" from a dropdown, you write a schedule string per camera axis - translation_x/y/z, rotation_3d_x/y/z, zoom - in the same keyframe syntax the whole pack uses: 0:(expr), 60:(expr). Out comes a camera track (a DIFFORUM_CAMERA object) plus an info summary of what the path actually did.
This is Deforum's camera engine, rebuilt. Each axis is an expression over t (frame) or s (seconds), evaluated per frame by the pack's whitelisted AST evaluator - no eval(), no arbitrary code. The default graph shows you the idiom immediately:
translation_z: 0:(1.5) # gentle forward dolly
rotation_3d_y: 0:(0.5*sin(2*pi*t/120)) # slow sway
That's the whole mental model: sin, cos, t, pi, plus your audio curves if you connect one. A push-in with a wobble, two expressions. Add a third and you're doing 3D camera work that took a paragraph of Deforum config in 2023.
The inputs that matter:
mode-2dor3d. 3D parses the translation/rotation axes into real perspective poses and needs a depth map downstream (see the gotcha below). 2D discards depth and works on any image, any time.fov- field of view in degrees, default 40. Set once per clip; it's a static value here, not a schedule (that's what Camera Keys is for).- The seven axis strings - the actual content.
zoommultiplies scale (1.0 = no zoom), rotations are degrees, translations are in pixels at the render resolution. audio(optional) - connectaudio_curvesfrom the Audio Analyzer and referenceamp/low/mid/high/onset/beatinside any axis expression. Camera that dances is the entire reason this socket exists.
Outputs: camera - the track everything downstream (Feedback Sampler, Guide Builder, Live Sampler) consumes - and info, a STRING that prints the mode, frame count, net translation, and zoom range. It's the cheapest sanity check in the pack: run it, read it, and you'll catch a nonsense path before it costs you a render.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/chillithebillis/Difforum.git difforum
Restart ComfyUI (console: [Difforum] loaded N nodes) or install via ComfyUI Manager → "Difforum". numpy-only dependency, so no pip hassle.
Common issues
- "3D mode does nothing - the frame doesn't move." This is the classic silent failure, and the pack itself warns about it: 3D axes only produce motion when a depth map actually reaches the warp. No depth input, no motion - just a camera doing math in a vacuum. Connect a depth map (Depth Anything V2 is the README's pick) to the sampler's
depthsocket and keepmode=3d, or drop tomode=2dwhere translation/zoom work everywhere. - A
2drender with rotation_3d axes set - those axes are discarded before the warp runs; you get a freeze, not an error. If the frame's frozen, check your mode. - Motion is violent. Defaults are gentle; if you write
0:(10*sin(t))remember the axes are in degrees/pixels and scale accordingly.translation_scaledownstream also tunes how far depth-based motion actually travels.
Start with Camera Move presets to feel out the pack, and keep this node for when you want exactly that sway, that spiral, that dolly-with-a-bob - or an audio-pumped camera that no preset dropdown will ever give you.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| params | DIFFORUM_PARAMS | — | |
| mode | COMBO | 3d | 2 options: 2d, 3d |
| fov | FLOAT | 401–170 | — |
| translation_x | STRING | 0:(0) | — |
| translation_y | STRING | 0:(0) | — |
| translation_z | STRING | 0:(1.5) | — |
| rotation_3d_x | STRING | 0:(0) | — |
| rotation_3d_y | STRING | 0:(0.5*sin(2*pi*t/120)) | — |
| rotation_3d_z | STRING | 0:(0) | — |
| zoom | STRING | 0:(1.0) | — |
| audioopt | DIFFORUM_AUDIO | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| camera | DIFFORUM_CAMERA | — |
| info | STRING | — |