# AIDepth

> Analyze runs Video Depth Anything Small (Apache-2.0, temporally stable) over the frames and aligns it to MoGe-2 (MIT) metric depth on a few keyframes.

Analyze runs Video Depth Anything Small (Apache-2.0, temporally stable) over the frames and aligns it to MoGe-2 (MIT) metric depth on a few keyframes. Output: depth layer (1/Z like ScanlineRender, or Z), optional depth_metric and N (camera-space normals), upsampled to the plate with a plate-guided filter. Create Camera makes a Camera with the estimated focal length. Model: Auto uses MoGe-2 ViT-B (measured as good as ViT-L and 4x faster); ViT-L is an optional download. Field of view, first that applies: Known FOV (when Field of View is set to known), a Camera on the cam input, the plate's header metadata, then the MoGe-2 estimate. Analyze on 1 to 3 frames keeps the models loaded, so the next frame is fast.

| Node | AIDepth |
|---|---|
| Menu | AI › AIDepth |
| **Names in each format** | |
| .oink comp (JSON) | `"type": "OC_N_aidepth"` |
| .nk script | none: written as an Oink node |
| Python | `nuke.createNode("OC_N_aidepth")` |
| Assistant (MCP) | `create_node(type="AIDepth")` |
| Tab search | `aidepth`, or its initials `aid` |

![AIDepth properties](/shots/nodes/aidepth@2x.webp)

## Inputs and outputs

| Port | Name | Type |
|---|---|---|
| input 0 | Image | image |
| input 1 | cam | scene |
| output 0 | Image | image |

## Knobs

Panel tab **Aidepth**, in panel order.

| Knob | Label | Type | Default | Range / values | .nk knob | Description |
|---|---|---|---|---|---|---|
| `depth_convention` | depth | menu | `inv` | inv (1/Z (Nuke)), z (Z) |  |  |
| `output_metric` | metric Z layer | bool | `false` |  |  | Also output depth_metric (.r = Z metres) |
| `output_normals` | normals layer | bool | `false` |  |  | Also run MoGe-2 on every frame for an N layer |
| `keyframes` | metric keyframes | float | `5` | 1 to 64 (integer) |  | Frames MoGe-2 measures for the metric scale / shift fit |
| `encode` | input | menu | `srgb` | srgb (scene linear), none (display) |  |  |
| `analysis_width` | analysis size | float | `1036` | 256 to 2048 (integer) |  | Long side of the frames sent to the model (px) |
| `fov_mode` | field of view | menu | `estimate` | estimate, known |  |  |
| `known_fov` | known FOV | float | `50` | 1 to 179 |  |  |
| `haperture` | horiz aperture | float | `24.576` | 0.1 to 100 |  | Film back width (mm) for the focal readout / Create Camera |
| `spatial_sigma` | upsample spatial | float | `1` | 0.1 to 4 |  | Joint bilateral spatial sigma (model pixels) |
| `range_sigma` | upsample edge | float | `0.08` | 0.005 to 2 |  | Joint bilateral range sigma (plate colour, lower = sharper edges) |
| `keep_other_frames` | keep other frames | bool | `false` |  |  | Analyze keeps results of frames outside the new range |
| `keep_loaded` | keep model loaded | bool | `false` |  |  | Leave the models in VRAM after Analyze (faster re-runs) |

### Other knobs (Python, .nk and the assistant; not on the panel)

| Knob | Label | Type | Default | Range / values | .nk knob | Description |
|---|---|---|---|---|---|---|
| `gl_color` | Viewer Controls Color | float ×3 | `0, 0, 0` | 0 to 1 |  |  |
| `postage_stamp_frame` | Static Frame | int | `1` | -2147483648 to 2147483647 |  |  |
| `lifetimeStart` | Lifetime Start | int | `0` | -2147483648 to 2147483647 |  |  |
| `lifetimeEnd` | Lifetime End | int | `100` | -2147483648 to 2147483647 |  |  |
| `useLifetime` | Use Lifetime | boolean | `false` |  |  |  |
| `cached` | Cached | boolean | `false` |  |  |  |
| `bookmark` | Bookmark | boolean | `false` |  |  |  |
| `dope_sheet` | Dope Sheet | boolean | `false` |  |  |  |
| `clone_group` | Clone Group | string |  |  |  |  |
| `link_source` | Link Source | string |  |  |  |  |
| `link_overrides` | Link Overrides | string |  |  |  |  |
| `split_views` | Split Views | string |  |  |  |  |
| `moge_model` | Model | enum | `AUTO` | AUTO, VITL, VITB |  | Geometry model (metric depth, field of view, normals); licence tier: optional / bundled |
| `results_data` | Results | string | `{}` |  |  |  |
| `fov_x` | FOV X (deg) | float | `0` | -3.4028234663852886e+38 to 3.4028234663852886e+38 |  |  |
| `fov_y` | FOV Y (deg) | float | `0` | -3.4028234663852886e+38 to 3.4028234663852886e+38 |  |  |
| `focal` | Focal (mm) | float | `0` | -3.4028234663852886e+38 to 3.4028234663852886e+38 |  |  |
| `analysed_first` | Analysed First | int | `0` | -2147483648 to 2147483647 |  |  |
| `analysed_last` | Analysed Last | int | `-1` | -2147483648 to 2147483647 |  |  |
| `fit_scale` | Fit Scale | float | `0` | -3.4028234663852886e+38 to 3.4028234663852886e+38 |  |  |
| `fit_shift` | Fit Shift | float | `0` | -3.4028234663852886e+38 to 3.4028234663852886e+38 |  |  |
| `fit_error` | Fit Error | float | `0` | -3.4028234663852886e+38 to 3.4028234663852886e+38 |  | Median relative depth error of the fit on the keyframes |


---
Sources: opencomp_core/nodes/ai/aidepth.py, opencomp_electron/src/components/properties/knobSchema.ts, opencomp_core/nodes/help/aidepth.md
