ANR Tools

ANR Scene Solver

Solves the camera and the scene from the plate with an AI model: a Nuke Camera with a real focal length, depth and position passes, a point cloud and a textured mesh.

  • Trackers
  • Trackers pack
  • Scene Solver models
  • 2 inputs
  • 30 controls

Overview

Hand the Scene Solver a shot and press Solve. The AI model returns, for every frame, a camera with a real focal length and a pose in metres, plus a depth map, all in one world whose origin is the Reference Frame's camera. Nothing to place and nothing to type.

By default the camera is then fitted to features tracked through the footage, the way a camera tracker works, so it sits on the picture (Fit Camera To Features). Status reports the fit as an error in plate pixels.

From the solve you get passes on the node's output (Depth, Position, Confidence), a mesh with Write Mesh, and on the Export tab a baked Camera, a point cloud, the mesh as a ReadGeo, or a whole test scene rendered over the plate.

Long shots are solved in windows: every Keyframe Every-th frame first, in passes of Views Per Pass frames anchored to each other, then the frames in between against the keyframes on either side.

Inputs

SourceMovingScene SolverOutput
  1. Sourcerequired

    The plate to solve.

  2. Movingoptional

    Optional matte, white where things move (people, cars, water). No features are tracked there when the camera is fitted. Use a rendered matte (alpha or luminance above half counts as moving), for example a Roto through a Shuffle or Premult.

Output. The plate, or with Output the solved Depth (metres, in red, green and blue, validity mask in alpha), Position (world X, Y, Z in Nuke's axes, mask in alpha) or the model's Confidence. Passes are computed at the model's resolution (518 px on the long side) and resampled to the plate.

Quick start

  1. Add ANR Scene Solver and connect the plate to Source.
  2. Set a Cache Folder on a drive with room (or press Generate Autofill). Solve will not run without one.
  3. Set Range and the Reference Frame: the frame whose camera becomes the world origin, ideally the one you will build on.
  4. If you know the lens, enter it in Known Focal Length (against Horizontal Aperture).
  5. Press Solve. It loads the model first if needed, then writes the camera to the node and the passes to the cache folder.
  6. Check Status for the fit error, then on the Export tab press Build Scene (look at it) to render the reconstruction back over the plate.
  7. When the solve sits on the plate, press Send To Camera for a baked Camera to use in your comp.

The panel

The node's panel as Nuke shows it, with the values of a new node. Click any control to see what it does; tabs and sections work as in Nuke.

ANR_Scene_Solver1

The solve: model, range, reference frame, lens, cache folder, output passes and the mesh.

Reconstruction ModelMap-Anything
Status
DeviceGPU (CUDA)
Load Model
Unload
RangeInput
Custom First0
Custom Last0
Reference Frame0
Keyframe Every2
Views Per Pass32
Fit Camera To Features
Solve
Clear Solve
OutputPlate
Known Focal Length0
Horizontal Aperture24.576
Generate Autofill
Cache Folder
Mesh FromReference Frame
Mesh Detail2
Bake Texture
Write Mesh

All controls

ANR Scene Solver23 controls

The solve: model, range, reference frame, lens, cache folder, output passes and the mesh.

Reconstruction ModelMenusceneModel

Choose a model, then solve the same shot on separate nodes to compare cameras, depth and geometry. ABot-Recon is an optional non-commercial research evaluation; its scene scale is in model units. Both models use the same exports.

Default: Map-AnythingOptions: Map-Anything ABot-Recon - research only

StatusStatusstatus

Reports whether the inference models are installed and which device is in use.

DeviceMenudevice

Automatic picks the fastest available and is what you want. The other two force a specific backend for testing: CUDA is the GPU, CPU is many times slower and cannot run tracking on the ONNX engine at all.

GPU (CUDA) is the default and what you want. CPU runs without a graphics card but is many times slower.

Default: GPU (CUDA)Options: GPU (CUDA) CPU

Load ModelButtonloadModel

Load the scene model into memory. 4.9 GB of weights; about 20 seconds. The node passes through until this succeeds.

UnloadButtonunloadModel

Release the model and its VRAM. Useful before rendering something else heavy on the same GPU.

RangeMenusceneRangeMode

Which frames to track. Input uses the range of the footage into this node, Global uses the project range, and Custom uses the two frame fields below.

Default: InputOptions: Input Global Custom

Custom FirstSlidersceneRangeStart

The frames to solve, when Range is Custom. Any length: a long shot is solved in windows anchored to each other.

Default: 0

Custom LastSlidersceneRangeEnd

The frames to solve, when Range is Custom. Any length: a long shot is solved in windows anchored to each other.

Default: 0

Reference FrameSlidersceneRefFrame

The frame whose camera is the world origin. That camera sits at 0,0,0 looking down -Z; every other frame and every point is placed relative to it. Pick the frame you will build on. Clamped into the range.

Default: 0

Keyframe EverySlidersceneKeyEvery

Every Nth frame is a keyframe. Keyframes are solved first, together, and the frames between them are placed against the keyframes on either side. 1 solves every frame as a keyframe, which is slowest and not steadier on ordinary footage; 4 is right for most shots, 8 for slow moves.

Default: 2

Views Per PassSlidersceneChunk

How many frames the model looks at in one pass. More is steadier and uses more VRAM: measured on a 12 GB card, 48 views peaks at 7.8 GB. Lower it if a solve runs out of memory.

Default: 32

Fit Camera To FeaturesCheckboxsceneRefine

After the model has answered, track features through the footage and fit every frame's camera and one focal length to them, the way a camera tracker does. The model's own camera is recovered from its ray field and misses its own points by a pixel or more, which scales with the plate; this is what makes the camera sit on the picture. The Status line reports the fit as an error in plate pixels. Off gives the model's raw camera.

Default: on

SolveButtonsceneSolve

Read the range, hand every frame to the model, and write the camera to this node and the depth and position passes to the cache folder. Loads the model first if it is not up.

Clear SolveButtonsceneClear

Delete the camera keys this node holds and forget the cached passes.

OutputMenusceneOutput

What the node's picture is.

Plate passes the input through.
Depth writes the solved z-depth, in metres, into red, green and blue, with the model's validity mask in alpha.
Position writes the world-space X, Y, Z of every pixel into red, green and blue, in Nuke's axes, with the mask in alpha -- feed it to a PositionToPoints for a point cloud, or use the Export tab.
Confidence writes the model's per-pixel confidence.

The passes are computed at the model's resolution (518 px on the long side) and resampled to the plate.

Default: PlateOptions: Plate Depth Position Confidence

Known Focal LengthSlidersceneKnownFocal

The lens the plate was shot on, in millimetres, if you know it -- against the Horizontal Aperture below. 0 solves it.

Worth setting whenever you can. On many shots the footage cannot pin the lens: a longer lens with the scene further away fits the tracked features almost exactly as well (measured on a rendered shot: the fit error changed by 0.08 px across 0.6x to 1.7x the true focal). The camera then sticks to the plate but the scene is the wrong shape and size, which shows the moment CG made to real dimensions goes in. A known lens is handed to the model as calibration and held by the camera fit.

Default: 0

Horizontal ApertureSlidersceneAperture

The sensor width the exported camera claims, in millimetres. The model reports a focal length in pixels; the field of view is what is real, and this turns it back into millimetres. Nuke's default.

Default: 24.576

Generate AutofillButtonanrCacheAutoFill

Create a new node-type/footage_letter_4digits folder on every click, then stop. Previous caches are kept. Enter a folder to choose a custom base.

Cache FolderFilesceneCacheDir

REQUIRED before Solve. The folder the solve writes into -- pick one on a drive with room, not the system drive. Each solve makes its own subfolder here holding one EXR a frame (depth, position, confidence, mask; about 3.6 MB a frame) and, after Write Mesh, the OBJ, its MTL and its texture. The node's picture is read from that subfolder, so a saved comp still shows its passes after the model is unloaded or Nuke restarted.

Default: empty

Mesh FromMenusceneMeshSource

Reference Frame builds the mesh from that one frame's depth. All Keyframes stitches every keyframe's mesh into one file -- more of the set, and more overlap where they agree.

Default: Reference FrameOptions: Reference Frame All Keyframes

Mesh DetailSlidersceneMeshStride

Grid step of the mesh, in model pixels. 1 is a vertex per pixel (150,000 a frame); 2 is a quarter of that and plenty for a projection surface; 4 is light enough to stitch every keyframe.

Default: 2

Bake TextureCheckboxsceneTextured

Write the mesh with UVs and a texture: the plate itself, projected from the frame the mesh came from. Reference Frame gives one texture at the plate's full resolution; All Keyframes packs a tile per keyframe into one image, no wider than 8192 px. One PNG beside the OBJ, nothing else. Import Mesh wires a Read of it into the ReadGeo.

Default: on

Write MeshButtonsceneWriteMesh

Build the mesh from the solve's cached passes and write it as an OBJ in the solve's folder, in Nuke's axes with vertex colours, and with Bake Texture a UV-mapped texture of the plate beside it. Works any time after a Solve -- the model does not have to be loaded. Import Mesh on the Export tab makes a ReadGeo for it.

Export7 controls

Turns the solve into Nuke nodes: a baked Camera, a point cloud, the mesh as a ReadGeo, or a whole test scene.

Camera SmoothingNumberanrSceneSmooth

Frames of Gaussian smoothing applied to the camera by Send To Camera. The model solves every frame on its own and each answer carries a small error, which reads as a shake the camera never made. With Fit Camera To Features on (the default) the solve is already steady and 0 is right; 3 to 5 helps a raw, unfitted solve.

Default: 0

Constant Focal LengthCheckboxanrSceneConstFocal

Export one focal length -- the median over the solve -- rather than a value a frame. A prime lens does not breathe; the per-frame wobble is the solve being unsure. Turn off for a zoom.

Default: on

Point Cloud FromMenuanrSceneCloudFrom

Reference Frame holds the cloud on that frame's pixels, so the set stands still while the camera moves through it -- what you want to build on. Every Frame shows each frame's own depth, which changes as the camera does.

Default: Reference FrameOptions: Reference Frame Every Frame

Send To CameraButtonanrSceneCamera

Build a Nuke Camera with the solved move baked into it -- position, rotation and a real focal length keyed on every frame, in metres. Baked, so it survives this node being deleted.

Create Point CloudButtonanrSceneCloud

A PositionToPoints over this node's Position output: every pixel of every frame as a point in the 3D viewer, coloured from the plate. Live, not baked -- it reads the passes in the cache folder.

Import MeshButtonanrSceneMesh

A ReadGeo on the OBJ that Write Mesh produced, with a Read of the baked texture wired into it when Bake Texture was on. Press Write Mesh on the node first.

Build Scene (look at it)ButtonanrSceneScene

Camera, point cloud, mesh if written, Scene and ScanlineRender over the plate. Render the reconstruction back over the footage: if it sits on it, the solve is good.

Tips

  • Set Known Focal Length whenever you can: the footage often cannot pin the lens, and a wrong lens makes the scene the wrong shape and size even when the camera sticks.
  • Create Point Cloud adds a second Scene Solver set to Position (reading the same cache, so the original stays on Plate), then a Copy into a P layer and a PositionToPoints coloured from the plate. Point Cloud From: Reference Frame holds the cloud on one frame so the set stands still while the camera moves.
  • For a projection surface: Write Mesh (Mesh From, Mesh Detail, Bake Texture), then Import Mesh for a ReadGeo with the baked texture read in and converted back to working space.
  • Send To Camera bakes a Camera keyed on every frame, driven by its matrix, with both apertures set. Camera Smoothing and Constant Focal Length on the Export tab shape it; turn Constant Focal Length off for a zoom.
  • Connect a matte of moving people or vehicles to Moving when they break the camera fit.
  • Lower Views Per Pass if a solve runs out of GPU memory.

Good to know

  • Needs an NVIDIA GPU for practical speed; the model is 4.9 GB and takes about 20 seconds to load. Unload frees the GPU memory.
  • If the Scene Solver models were not installed with ANR Tools, Nuke offers to download them when you create the node. After the download, try again; restart Nuke if it asks you to.
  • Each solve makes its own subfolder in the Cache Folder, about 3.6 MB a frame. The node's picture is read from there, so a saved script still shows its passes after the model is unloaded or Nuke restarts.
  • A WARNING in Status means the camera could not be fitted to features (too few tracks) and the model's own camera was kept.
  • The scale is the model's own metric estimate. The mesh is a grid over the depth map, not a fused surface; people moving through the shot end up in it where they stand.
  • The Export tab's camera and mesh are baked copies. Solve again, then export again, after you change the shot.

Something unclear or missing? Write to [email protected].