Nodes/Difforum/Difforum · Camera (advanced)
ComfyUI Node

Difforum · Camera (advanced)

Full Deforum 2D/3D camera control, expression by expression

By chillithebillis·Created 3 months ago·Updated about a month ago· 7
Difforum · Camera (advanced)
  • params
  • audio
  • camera
  • info
mode3d
fov40
translation_x0:(0)
translation_y0:(0)
translation_z0:(1.5)
rotation_3d_x0:(0)
rotation_3d_y0:(0.5*sin(2*pi*t/120))
rotation_3d_z0:(0)
zoom0:(1.0)

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 - 2d or 3d. 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. zoom multiplies scale (1.0 = no zoom), rotations are degrees, translations are in pixels at the render resolution.
  • audio (optional) - connect audio_curves from the Audio Analyzer and reference amp/low/mid/high/onset/beat inside 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 depth socket and keep mode=3d, or drop to mode=2d where translation/zoom work everywhere.
  • A 2d render 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_scale downstream 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.

CategoryDifforum/hybrid

Inputs (11)

NameTypeDefaultDescription
paramsDIFFORUM_PARAMS
modeCOMBO3d2 options: 2d, 3d
fovFLOAT401–170
translation_xSTRING0:(0)
translation_ySTRING0:(0)
translation_zSTRING0:(1.5)
rotation_3d_xSTRING0:(0)
rotation_3d_ySTRING0:(0.5*sin(2*pi*t/120))
rotation_3d_zSTRING0:(0)
zoomSTRING0:(1.0)
audiooptDIFFORUM_AUDIO

Outputs (2)

NameTypeDescription
cameraDIFFORUM_CAMERA
infoSTRING