Nodes/ComfyUI-NKD-VFX-Tools/😺NKD Camera Delta Prompt
ComfyUI Node

😺NKD Camera Delta Prompt

Your Two Cameras, One JSON the Model Actually Reads

By Nekodificador·Created 6 months ago·Updated a day ago· 155
😺NKD Camera Delta Prompt
  • camera_from
  • camera_to
  • prompt
â—„templateReferring to the scene in image 1, restore the perspective of the scene in image 2. Repair the perspective and missing areas. The camera has moved by: {camera}â–º
â—„spacecameraâ–º
â—„scale1.00â–º
â—„decimals3â–º
â—„flip_zfalseâ–º
â—„flip_rotationfalseâ–º

You cannot prompt your way to "the camera moved 40 cm right and pitched three degrees." Diffusion models don't do that math. But there is a family of LoRAs that does understand exactly that - the "the camera has moved by: {...}" repair LoRAs, of which cyrildiagne's flux2-klein-mlsharp-3d-repair is the one you'll hear about first. They condition on a camera delta written as JSON inside the text prompt. The problem, if you've ever looked at one: getting that JSON written by hand is miserable, and most people don't even know what the format should be.

NKD Camera Delta Prompt is the missing translator. Feed it the camera you started with and the camera you moved to, and it writes the JSON for you.

How it works

Both inputs are LOAD3D_CAMERA payloads - the same camera dicts ComfyUI's core 3D nodes already produce. The node computes the translation and rotation between them, decomposes the rotation into pitch/yaw/roll in degrees (three.js's YXZ order), and prints the move as {"x":...,"y":...,"z":...,"pitch":...,"yaw":...,"roll":...}. The zero case is reproduced verbatim - that {"x":0,"y":0,"z":0,...} string is the one known-good sample the LoRA author actually published, and it's the format every example you'll see online uses.

The inputs that matter

  • camera_from / camera_to - where the shot started and where it ended. The obvious pairing is the solved plate camera (NKD fSpy Camera) or the camera_info you fed into Preview 3D as camera_from, and Preview 3D's camera_info output after unlocking the camera and orbiting as camera_to.
  • template - your prompt, with {camera} where the JSON lands. Leave the token out and the prompt returns unchanged; set the template to just {camera} to get the JSON alone (handy for checking your numbers first).
  • scale - the dial for the fact that your scene units are almost certainly not the LoRA's. It was trained on COLMAP poses, which have arbitrary scale.
  • flip_z and flip_rotation - sign correction. three.js has -Z forward, OpenCV has +Z forward, and those two disagree on exactly that axis.

The output is a single prompt string you drop into your text encoder.

The honest caveat

Nobody has published whether the LoRA was trained on camera-space or world-space coordinates - the author was asked on the model card and never answered. So space (camera vs world) and scale are calibration knobs, not nice-to-haves. Start with the default, and when the repair pushes the scene the wrong way, flip_z is the first thing to try. To reverse the move entirely, swap the two camera cables instead.

Install and gotchas

Same story as the whole pack: ComfyUI Manager, search "NKD VFX Tools", install, restart. Nothing to download, no models. If the repair goes the wrong direction, that's the three.js/OpenCV axis disagreement, not a broken node - flip a sign, don't reinstall. This is the node I'd call the pack's hidden gem: it solves a problem (that JSON) that every camera-move LoRA user quietly struggles with.

Category😺NKD Nodes/3D

Inputs (8)

NameTypeDefaultDescription
camera_fromLOAD3D_CAMERAThe camera of image 1 — where the shot started. Typically the solved plate camera (😺NKD fSpy Camera), or the camera_info you fed into Preview 3D.
camera_toLOAD3D_CAMERAThe camera of image 2 — where you moved to. Typically Preview 3D's camera_info output, after unlocking the camera and orbiting.
templateSTRINGReferring to the scene in image 1, restore the perspective of the scene in image 2. Repair the perspective and missing areas. The camera has moved by: {camera}Your prompt. '{camera}' is replaced by the JSON. Leave it out and you get the prompt unchanged; set the template to just {camera} to get the JSON alone.
spaceCOMBOcameraFrame for x/y/z. 'camera': the FROM camera's own axes (+X right, +Y up, -Z forward), so the numbers read as 'moved right / up / back'. 'world': raw scene axes. UNVERIFIED against the LoRA — nobody published which one it was trained on. Try both.
scaleFLOAT1.00-1000–1000Multiplies x/y/z. Your scene units are almost certainly not the LoRA's: it was trained on COLMAP poses, which have arbitrary scale. This is the dial for that.
decimalsINT30–6Decimal places. Trailing zeros are dropped, so an unmoved camera always prints the template's exact {"x":0,...} whatever this is set to.
flip_zBOOLEANfalseNegate z. The first thing to try when the repair pushes the scene the wrong way: three.js has -Z forward, OpenCV has +Z forward, and the two disagree on exactly this axis.
flip_rotationBOOLEANfalseNegate pitch/yaw/roll, for when the camera turns the opposite way to what you asked. To reverse the move entirely, swap the two camera cables instead.

Outputs (1)

NameTypeDescription
promptSTRINGThe template with {camera} filled in.