Nodes/ComfyUI-SD-CN-Animation/SD-CN Motion Control
ComfyUI Node

SD-CN Motion Control

Camera moves for the SD-CN Txt2Vid node, without a ControlNet

By pxl-pshr·Created 5 months ago·Updated 5 months ago· 13
SD-CN Motion Control
    • motion_ctrl
    occlusion_multiplier10.0
    flow_scale1.00
    pan_x0.0
    pan_y0.0
    zoom1.000
    rotate0.0

    If you've ever built a Txt2Vid workflow with the SD-CN Animation node and wished you could make the camera drift without bolting on a depth ControlNet, this is the node. SD-CN Motion Control is a tiny parameter box that rides shotgun on the SDCNTxt2Vid node's optional motion_ctrl input. Wire it in and it twists FloweR's predicted motion to add pans, zooms, rotation, and speed control to whatever the model would have done on its own. Leave the input unwired and Txt2Vid behaves exactly as normal - the node is strictly an upgrade.

    How it works

    SDCNTxt2Vid normally takes FloweR's predicted optical flow as gospel. This node hands Txt2Vid a dict of six floats, and the animation node applies them at generation time. The clever part is where each knob operates:

    • flow_scale and pan_x/pan_y modify the optical flow field directly - scaling how far each pixel is predicted to move, or adding a constant drift per frame.
    • zoom and rotate are applied as affine transforms on the composited prediction.
    • occlusion_multiplier amplifies the occlusion mask before it reaches the SD inpaint pass, so it decides how much of each frame gets regenerated.

    Everything is per-frame, which is the thing that trips people up. A zoom of 1.005 sounds like nothing, but compounded over 90 frames it's a real push-in. Conversely 1.1 will feel like a warp-speed crash. Subtlety is the whole game here.

    The dials that matter

    • occlusion_multiplier - default 10.0, and the tooltip says it plainly: that value matches standard behavior. Higher = more of each frame gets redrawn by SD (more creative freedom, less coherence); lower = tighter temporal lock. The README pairs flow_scale: 1.3 with occlusion_multiplier: 15 for "dreamy drift."
    • flow_scale - 1.0 is identity. <1 slows the motion FloweR predicts, >1 exaggerates it.
    • pan_x / pan_y - pixels per frame of horizontal/vertical drift. Positive pan_x pans right. Start around 1.5 for a gentle pan.
    • zoom - per-frame scale, >1 zooms in, <1 zooms out. Use increments like 1.005.
    • rotate - degrees per frame. Keep it tiny; it's the easiest knob to make the world spin into a mess.

    The only output is a single motion_ctrl wire, which goes straight into the motion_ctrl input on SDCNTxt2Vid. There's nothing else to it - no models, no images, no conditioning.

    Install

    Same as the rest of the pack - ComfyUI Manager (search "ComfyUI-SD-CN-Animation") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/pxl-pshr/ComfyUI-SD-CN-Animation
    

    Restart and you're done. This node has no extra dependencies of its own beyond the pack's opencv-python, scikit-image, and scipy, and it doesn't load any model weights - the FloweR model the motion is applied to comes from the Load FloweR Model node on the Txt2Vid side.

    Gotchas

    The honest version: because it rewrites FloweR's flow field, aggressive settings can make the optical-flow prediction and your injected motion disagree, which the inpaint pass then has to paper over - and that costs coherence. If things get swimmy, dial occlusion_multiplier down, not the motion up. And remember this only affects Txt2Vid. The Vid2Vid node uses RAFT on real input frames, so camera moves there come from the footage itself, not from this node. Think of it as the cheap fake dolly for the text-to-video side.

    CategorySD-CN-Animation

    Inputs (6)

    NameTypeDefaultDescription
    occlusion_multiplierFLOAT10.00–50Amplifies occlusion mask. Higher = more of each frame gets regenerated by SD. Default 10.0 matches standard behavior.
    flow_scaleFLOAT1.000–3Multiplier on predicted optical flow magnitude. <1 = slower motion, >1 = exaggerated motion.
    pan_xFLOAT0.0-20–20Horizontal drift in pixels/frame added to flow. Positive = pan right.
    pan_yFLOAT0.0-20–20Vertical drift in pixels/frame added to flow. Positive = pan down.
    zoomFLOAT1.0000.9–1.1Per-frame scale factor. >1 = zoom in, <1 = zoom out. Subtle values like 1.005 work best.
    rotateFLOAT0.0-5–5Degrees/frame rotation applied to the prediction.

    Outputs (1)

    NameTypeDescription
    motion_ctrlMOTION_CTRL