ANR Tools

ANR Depth and Normal Creator

Makes a depth pass, and with MoGe-2 also normals and positions, from any plate with AI, straight into depth.Z, N or P with the plate untouched.

  • Utility
  • Comp & Depth pack
  • Depth & Normals models
  • 1 input
  • 36 controls

Overview

Depth and Normal Creator gives a plate with no CG passes the depth it never had. Pick a Model, play the shot, and every frame gets a depth map, worked out by the AI model from the picture alone.

MoGe-2 (the default) gives sharp depth in real metres, one frame at a time, and estimates the lens from the picture. It is also the model that makes Normals and Position passes in Nuke's camera space. Video Depth Anything looks at 32 frames at once, so a whole shot stays consistent: the choice for shots that flicker. Its relative depth is placed between Near Distance and Far Distance; Video Depth Anything Metric gives metres.

By default the plate passes through untouched and the depth lands in depth.Z, in Nuke's own 1/distance convention, ready for ZDefocus and the 3D nodes. Write To can put normals in the N layer or positions in the P layer instead (connect PositionToPoints for a point cloud), or write the result into the RGB channels.

The pass is also the start of the ANR depth tools: set Write To to RGB and connect the result to ANR Depth Prep (for depth) or ANR Normals Prep (for normals). From there ANR Depth Matte, Depth Look, Depth Camera, Normals Matte and Normals Light take over.

Solved frames are kept in memory; Freeze and Bake to Disk writes them to EXR files so the comp later opens with no AI engine running.

Inputs

Input1Depth and Normal CreatorOutput
  1. Input1required

    The plate. The AI model sees its picture (converted to sRGB first, with Apply sRGB to Input on); the plate itself passes through.

Output. The plate untouched, with the depth in depth.Z (the default), the normals in N or the positions in P. With Write To on RGB, alpha or both, the result replaces those channels instead, as Output sets it: Nuke depth (1/distance), distance, a normalized 0 to 1 pass, normals or position.

Quick start

  1. Add ANR Depth and Normal Creator under the plate and view it. The first frame takes longer while the model loads.
  2. Keep Model on MoGe-2 for sharp metric depth; switch to Video Depth Anything if the depth flickers on playback.
  3. View the depth.Z channel. For ZDefocus, keep Write To on depth.Z (plate untouched) and Output on Nuke Depth (inverse distance).
  4. To use the ANR depth tools, set Write To to RGB (alpha passes through) and Output to Distance (metres), and connect it to the Depth input of ANR Depth Prep.
  5. For normals, choose N layer, normals (plate untouched), or set Output to Normals (camera space, MoGe-2) and Write To to RGB for ANR Normals Prep.
  6. Press Analyse Shot (on the Bake to Disk tab) to solve the whole shot with a progress bar.
  7. Set a Cache Folder and turn on Freeze and Bake to Disk to keep the result on disk.

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_Depth_and_Normal_Creator1

The model, the output and where it is written.

Status
ModelMoGe-2 (Large) - sharp, metres, estimates the lens
Processing Resolution1036
Temporal Consistency
OutputNuke Depth (inverse distance)
Near Distance1
Far Distance100
Invert
Write Todepth.Z (plate untouched)

All controls

ANR Depth Creator9 controls

The model, the output and where it is written.

StatusStatusstatus

What the node is doing, and any problem it hit.

ModelMenumodel

Which network makes the depth.

MoGe-2: sharp, detailed depth in metres, one frame at a time, with the camera's field of view estimated from the picture (or given as a lens).
Video Depth Anything: sees 32 frames at once, so a whole shot stays consistent -- the choice for anything that flickers. Small model, softer detail; relative depth placed with Near / Far.
Video Depth Anything Metric: the same, in metres.

All of these are licensed for commercial work.

Default: MoGe-2 (Large) - sharp, metres, estimates the lensOptions: MoGe-2 (Large) - sharp, metres, estimates the lens Video Depth Anything (Small) - consistent over the shot Video Depth Anything Metric (Small) - metres, consistent

Processing ResolutionSliderresolution

The longest side of the picture the model sees, in pixels. More is more detail and more graphics memory; the models were trained near 500 to 1000 and 1036 is a good default on a 12 GB card. Rounded to a multiple of 14.

Default: 1036

Temporal ConsistencyCheckboxtemporal

Keep the depth scale steady from frame to frame. The video models align each new window of frames to the frames already solved; the single-frame models are aligned to their solved neighbours by scale and offset. Off gives each frame its own scale, which flickers.

Default: on

OutputMenuoutput

What the pixels hold.

Nuke Depth (1/distance): what ScanlineRender writes to depth.Z and what ZDefocus, DeepFromImage and the 3D nodes expect. Near is large, far is near 0.
Distance: metres (metric models) or the Near / Far range (relative models). Near is small.
Normalized, near = white: 0..1, for grading, mattes and viewing.
Normalized, far = white: the same, inverted.
Normals: MoGe-2 only. Unit surface normals in Nuke's camera space (x right, y up, z toward the camera) in RGB, for Relight and for shading.
Position: MoGe-2 only. Camera-space position in metres in RGB, the P pass Relight and PositionToPoints want.

Shuffle depth into depth.Z, normals into N and position into P downstream.

Default: Nuke Depth (inverse distance)Options: Nuke Depth (inverse distance) Distance (metres) Normalized, near = white Normalized, far = white Normals (camera space, MoGe-2) Position (camera space metres, MoGe-2)

Near DistanceSlidernearDistance

Video Depth Anything (relative): the distance, in scene units, the nearest pixel of the range is placed at. Metric models ignore it; they are already in metres.

Default: 1

Far DistanceSliderfarDistance

Video Depth Anything (relative): the distance the farthest pixel of the range is placed at. Metric models ignore it.

Default: 100

InvertCheckboxinvert

Flip near and far: a normalized pass becomes its opposite, Nuke Depth becomes Distance and Distance becomes Nuke Depth.

Default: off

Write ToMenuoutputTo

Where the result goes.
RGB, Alpha only, RGB and alpha: the node's own channels, as in ANR Depth Creator.
depth.Z: the plate passes through untouched (RGB and alpha) and the depth lands in depth.Z, ready for ZDefocus, DepthToPosition and any node that reads Nuke depth.
N layer: the plate untouched, normals in N.XYZ (Output is set to Normals for you).
P layer: the plate untouched, camera-space positions in P.XYZ (Output is set to Position): connect PositionToPoints for the point cloud, inside Nuke, no file written.

The ANR depth and normals nodes read only the red, green, blue and alpha channels, never depth.Z, N or P. To feed ANR Depth Prep or ANR Normals Prep, choose RGB (alpha passes through).

Default: depth.Z (plate untouched)Options: RGB (alpha passes through) Alpha only (RGB passes through) RGB and alpha depth.Z (plate untouched) N layer, normals (plate untouched) P layer, position (plate untouched)

Range5 controls

Which values count as nearest and farthest, for the relative model and the normalized passes.

RangeMenurangeMode

Which raw values count as nearest and farthest: for the relative model, the ends of the Near / Far placement; for the metric models, the white and black points of the normalized outputs.

Per Frame: each frame's own extremes. Simple, and the scale breathes as things enter and leave.
Whole Shot: the extremes over every frame solved so far, so the shot shares one scale. Analyse Shot first for a fixed answer.
Manual: the values below. Freeze Range copies the current automatic values here.

Default: Auto, Whole ShotOptions: Auto per Frame Auto, Whole Shot Manual

Range LowSliderrangeLow

The raw model values (metres for the metric models) treated as nearest and farthest, in Manual mode.

Default: 0

Range HighSliderrangeHigh

The raw model values (metres for the metric models) treated as nearest and farthest, in Manual mode.

Default: 1

Range Clip %SliderrangeClip

Ignore this percentage of the very nearest and very farthest pixels when finding the automatic range, so a speck or a highlight does not set the scale. 0 is the exact extremes.

Default: 0.5

Freeze RangeButtonfreezeRange

Copy the range in use on this frame into Range Low / High and switch to Manual.

Edge Refine3 controls

An optional, experimental reshaping of the depth edges to the picture's edges.

Edge RefineMenuedgeMode

The model answers at the processing resolution. Off scales it up smoothly, which is clean and is the default. Guided (experimental) reshapes the depth edges to follow the picture's own edges at full resolution with a guided filter, applied only where the depth has an edge; on a 4K plate it can tighten a soft silhouette, but it can also add a rim where the picture and the depth disagree. Compare before trusting it.

Default: Off (smooth scale-up)Options: Off (smooth scale-up) Guided by the picture (experimental)

Edge RadiusSlideredgeRadius

How far, in full-resolution pixels, the depth may be reshaped around an edge. About the width of the model's own blur once scaled up: 4 on HD, 8 to 12 on a 4K plate.

Default: 4

Edge DetailSlideredgeDetail

How strictly the depth follows the picture's edges. Low is soft and clean; high is razor sharp and starts to follow texture and noise.

Default: 0.5

Focal Length (metric models)5 controls

The lens: estimated by MoGe-2 or typed in, and keyed onto Estimated Focal for a Camera.

Focal LengthMenufocalMode

MoGe-2 scales with the lens. Estimate lets it read the field of view from the picture; Manual uses the values below, and is right whenever you know the lens.

Default: Estimate from the pictureOptions: Estimate from the picture Manual

Focal (mm)SliderfocalMm

The lens focal length and the sensor's width, so the focal length in pixels is focal / sensor width x image width. 36 mm is full frame; 24.9 mm is Super 35.

Default: 35

Sensor Width (mm)SlidersensorMm

The lens focal length and the sensor's width, so the focal length in pixels is focal / sensor width x image width. 36 mm is full frame; 24.9 mm is Super 35.

Default: 36

Estimated Focal (mm)SliderestimatedFocal

The focal length MoGe-2 estimated, in mm for the sensor width above, keyed per solved frame by Set Focal Keys. An ANR Camera node pointed at this node (or any Camera whose focal is linked to this knob, with the same haperture) lines up with the Position pass and PositionToPoints: the camera lives in the comp, no file needed.

Stays at its default until you press Set Focal Keys, which keys it on every solved frame. To line up a Camera, link its focal length to this knob and set its horizontal aperture to Sensor Width (mm).

Default: 35

Set Focal KeysButtonsetFocalKeys

Write the estimated focal length of every solved frame as keys on Estimated Focal. Analyse the shot first (or play through it) for a complete curve. MoGe-2 only: the video models do not estimate the lens.

Bake to Disk14 controls

Freezing the result to EXR files, plus Analyse Shot, the device, the memory cache and loading or unloading the model.

Freeze and Bake to DiskCheckboxbake

Write every frame that renders as an EXR with a Z channel and play them back from disk. With this on, opening the comp starts no AI engine and uses no graphics memory. The baked file holds the finished output, so change Output before baking, and turn this off to re-render.

Default: off

Generate AutofillButtonanrCacheAutoFill

Create a fresh node-type/footage_letter_4digits subfolder on every click, then stop. Previous caches are kept.

Makes a new, empty folder for this node each time you click it and puts it in Cache Folder. It goes next to the saved script by default (ANR > Cache Folders > Location in Nuke's menu bar can put it next to the footage); a folder you typed into Cache Folder is used as the base instead. Save the script first.

Cache FolderFilebakeDir

Each node writes //.####.exr. Read the sequence back with an ordinary Read node; the depth is in depth.Z.

Each node writes its EXR sequence into a subfolder named after Name Prefix inside this folder. Set it before you turn on Freeze and Bake to Disk.

Default: empty

Name PrefixTextbakePrefix

Name of the baked sequence; empty uses depth_. '#' characters set the frame padding.

Default: empty

Limit to Frame RangeCheckboxbakeRange

Only bake (and play back) between these frames; outside them the source passes through.

Default: off

FromSliderbakeFrom

Bake Range

Default: 1

ToSliderbakeTo

Bake Range

Default: 100

System

Analyse ShotButtonanalyseShot

Solve every frame of the source now, with a progress bar, filling the cache. Whole Shot range is then final, and playback is instant until the cache is full.

Clear CacheButtonclearCache

Forget every solved frame; they are solved again as they render.

DeviceMenudevice

GPU (NVIDIA, CUDA) or CPU. CPU is many times slower and only for machines without a card.

Default: GPUOptions: GPU CPU

Apply sRGB to InputCheckboxsrgbInput

The models were trained on display-referred pictures. On, for a linear working space (Nuke's default): the plate is converted to sRGB before the model sees it. Off when the input is already display-referred or you colour-manage upstream.

Default: on

Depth Cache (MB)SlidercacheBudget

How much memory solved frames may take per node before the oldest are dropped. A frame is about 2.5 MB at the default resolution. Bake to disk for long shots.

Default: 1024

Load ModelButtonloadModel

Start the inference helper and load the chosen model now. Otherwise it happens on the first render.

UnloadButtonunloadModel

Stop the helper and give every byte of graphics memory back.

Tips

  • Range > Auto, Whole Shot keeps one scale over the shot, but it only knows the frames solved so far: press Analyse Shot first, then Freeze Range to fix it.
  • If you know the lens, set Focal Length > Manual with the focal length and sensor width: MoGe-2's metres follow the lens, so a known lens gives truer distances.
  • Set Focal Keys writes MoGe-2's lens estimate of every solved frame onto Estimated Focal (mm). Link a Nuke Camera's focal length to it, with the horizontal aperture set to Sensor Width (mm), and the Camera lines up with the Position pass and PositionToPoints.
  • Processing Resolution is the size of the picture the model sees. More gives finer detail and uses more graphics memory; 1036 suits a 12 GB card.
  • Edge Refine > Guided by the picture (experimental) can tighten a soft silhouette on a 4K plate, but can also add a rim. Compare it with Off before you keep it.
  • Invert swaps near and far: Nuke depth becomes distance and the other way round.

Good to know

  • The node needs an NVIDIA graphics card for practical speeds; Device > CPU is many times slower.
  • If the Depth & Normals models were not installed with ANR Tools, Nuke offers to download them the first time you add the node in a session (Download models or Not now). After the download, render the frame again.
  • Normals and Position come from MoGe-2 only; the video models do not make them, and they do not estimate the lens.
  • Changing Model, Processing Resolution, Temporal Consistency, the focal length settings, Apply sRGB to Input or Device throws away the solved frames; they are solved again as they render.
  • The baked EXRs hold the finished output, so choose Output before you bake. A Read of the baked sequence gives the depth in depth.Z (or N or P for the vector passes).
  • Solved frames are kept up to Depth Cache (MB) (about 2.5 MB a frame at the default resolution); older ones are dropped and solved again. Bake long shots.
  • After about ten minutes without work (sooner when the graphics card is nearly full), the node gives its graphics memory back. The next frame loads the model again, which takes a moment.

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