Nodes/camera-comfyUI/SaveTrajectory
ComfyUI Node

SaveTrajectory

Exporting a camera path so you can reuse the exact same move

By Alexankharin·Created about a year ago·Updated about a month ago· 36
SaveTrajectory
  • trajectory
    filename_prefixComfyUITrajectory

    In camera-comfyUI, a "trajectory" is a sequence of camera poses - a stack of N×4×4 world-to-camera matrices that describe a path through 3D space. SaveTrajectory is the node that writes one of those tensors to disk as a .npy file so you can reuse the exact same camera move later, on a different scene, or across different render backends. It's the memory function for camera paths.

    This matters more than it sounds. Trajectories in this pack are the thing that drives everything downstream: CameraMotionNode animates along one, RenderSplats4DVideo walks a camera path while sweeping time, ProjectPointCloud and the enrichers all take a path to visit. A trajectory you record once - via the interactive Open3D CameraTrajectoryNode, or by interpolating between two poses with CameraInterpolationNode - is genuinely reusable. Save it and you've got the same dolly move on tap for every future project, no re-recording.

    How it works

    Give it a trajectory TENSOR (N,4,4) and a filename_prefix (default ComfyUITrajectory, with the usual %date:yyyy-MM-dd% format tokens supported), and it writes a .npy file to your ComfyUI/output/ folder, appending a counter. It's an output node - no data output, just a UI entry pointing at the saved file. .npy is the pack's native trajectory format because it preserves the tensor exactly; you reload it with the matching LoadTrajectory node and feed it straight back into any node that expects a trajectory.

    One practical tip: name your prefixes meaningfully. ComfyUITrajectory_00001.npy tells you nothing a week later; orbit_right_180deg does. The counter keeps collisions from clobbering your work either way.

    When you'd use it

    • You hand-recorded a walk in the Open3D GUI and want it preserved forever. Save it.
    • You're sharing a workflow: bundling a .npy trajectory alongside the JSON means the receiver's camera path is your camera path, not a guess.
    • You want the same move applied to a point cloud, a splat world, and a 4D scene - save once, load into each branch.

    Installing it

    It's in the camera-comfyUI pack; installing the pack once gives you all the trajectory nodes. ComfyUI Manager → Custom Nodes Manager → camera-comfyUI → Install, then restart. Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Alexankharin/camera-comfyUI.git
    cd camera-comfyUI && python install.py
    

    SaveTrajectory needs no optional dependencies, so it's usable right after the pack loads.

    Common issues

    • Wrong shape - the input has to be a batched N,4,4 tensor. A single 4×4 matrix will fail or save something meaningless; most trajectory-producing nodes output the batched form, so check upstream if you see an error.
    • Forgetting the inverse convention - trajectories here are world-to-camera poses. If your file renders a mirrored or backwards move, the poses themselves are likely inverted, not the save. TrajectoryInvert fixes that.

    Record once, replay forever.

    CategoryCamera/Trajectory

    Inputs (2)

    NameTypeDefaultDescription
    trajectoryTENSOR
    filename_prefixSTRINGComfyUITrajectoryPrefix for the .npy file. You can include format-tokens like %date:yyyy-MM-dd%.

    Outputs (0)

    No outputs