Nodes/Deforum Nodes/(deforum) Frame Warp
ComfyUI Node

(deforum) Frame Warp

The 3D camera move that makes Deforum feel like flight

By XmYx·Created 3 years ago·Updated 4 months ago· 198
(deforum) Frame Warp
  • image
  • deforum_frame_data
  • depth_image
  • IMAGE
  • DEPTH
  • WARPED_DEPTH
warp_depth_imagefalse

Every frame of a Deforum animation starts as the previous frame, transformed. (deforum) Frame Warp is the transform - the node that takes a rendered frame, moves the camera according to your translation schedules, and produces the next frame's starting image. In 2D mode it's zoom/pan/rotate; in 3D mode it's the depth-driven camera move that makes a flat image feel like you're flying through it. This is the workhorse that actually generates the motion everyone associates with Deforum.

How it works

The node passes the frame and your camera parameters into Deforum's anim_frame_warp routine. The critical ingredient is a depth model (MiDaS-class, selected by the depth parameters in deforum_data): in 3D mode the warp displaces pixels along the depth map, so close objects move differently from far ones - that parallax is what sells the camera travel. The node lazily loads and caches the depth model, and it outputs the warped frame plus the depth map it computed (and a separately warped depth version if you ask).

It also threads a thread of continuity: it keeps the last computed depth internally and reuses it across frames, so the camera motion stays coherent instead of re-estimating depth from scratch every frame (which would flicker).

The inputs that matter

  • image - the current rendered frame.
  • deforum_frame_data - carries args, anim_args, keys, and frame_idx; the node reads animation_mode, the depth algorithm, the translation schedules, and the current frame number from here. No frame data, no warp.
  • warp_depth_image (BOOLEAN, default false) - when true, also warps the depth map itself (so the depth follows the camera too) and returns it as WARPED_DEPTH. Needed for stable 3D when the depth feeds back in.
  • depth_image (optional IMAGE) - an external depth map to use instead of estimating one. Handy if you have a better depth source (or a ControlNet depth preprocessor) and want to skip the built-in model.

Outputs:

  • IMAGE - the warped frame (the next animation frame's base).
  • DEPTH - the estimated depth map.
  • WARPED_DEPTH - the depth map after warping (only meaningful when warp_depth_image is on).

Installing this pack

Part of Deforum Nodes by XmYx. ComfyUI Manager: search Deforum Nodes, or:

cd ComfyUI/custom_nodes
git clone https://github.com/XmYx/deforum-comfy-nodes

Restart, let install.py pull the deforum-studio backend from GitHub plus the scientific-Python stack (numpy < 2.0, Python 3.10 required). The depth model weights are downloaded by the backend on first use - the first warp is slow, the rest are fast.

Common issues

  • First run hangs on a download. The depth model is fetched on demand. Give it a minute.
  • Frame 0 looks wrong / no warp on frame 0. The node resets its depth cache at frame_idx == 0; the first frame has no previous depth to warp against, so it can return the input essentially unchanged. That's expected.
  • Black or smeared edges. Camera moves reveal empty frame area; the border setting in Animation Parameters decides how it's filled (wrap/replicate/zeros). Smearing usually means a high motion step into empty space - reduce the move or use wrap.
  • Very slow 3D warp. Depth estimation at high resolution plus pixel displacement is the bottleneck. Warp at moderate resolution and upscale after, or drop to 2D mode for speed.
Categorydeforum/image

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
deforum_frame_dataDEFORUM_FRAME_DATA
warp_depth_imageBOOLEANfalse
depth_imageoptIMAGE

Outputs (3)

NameTypeDescription
IMAGEIMAGE
DEPTHIMAGE
WARPED_DEPTHIMAGE