JOS JOS Compositor

Node reference

Depth nodes

DepthGenerator

Depth from the camera's motion (ours, approximate): the optical flow's parallax, scaled by the camera's move when there is one.

Inputs: Source, Camera (optional, track data), Mask (optional).

Setting Default Range or choices What it does
Depth Output Depth (1/Z) Depth (1/Z), Distance What depth.Z holds: 1/distance, or the distance itself.
Frame Separation 1 1 to 10 How many frames later the frame compared with this one is; more gives more parallax.
Depth Detail 0.5 0 to 1 The resolution the optical flow is worked out at (1: full; at least 0.05).
Strength 1 0 to 1 How smooth the optical flow is made while it is worked out (more: smoother motion).
Smoothness 0.5 0 to 1 Blurs the depth afterwards (a gaussian of 4 pixels per unit); 0: off.
Near Clip Plane 0.1 0 to 1 The smallest distance the result gives.
Far Clip Plane 10000 0 to 20000 The largest distance the result gives (also where nothing moves).
Ignore Mask None None, Source Alpha, Source Inverted Alpha, Mask Luminance, Mask Inverted Luminance, Mask Alpha, Mask Inverted Alpha Kept for Nuke scripts, not used yet.
Smoothness weight 0.5 0 to 1 Kept for Nuke scripts, not used.
Sharpness 0.5 0 to 1 Kept for Nuke scripts, not used.
Noise 0.01 0 to 1 Kept for Nuke scripts, not used.

How it works. DepthGenerator guesses how far each pixel is from the camera by watching how it moves. It compares each frame with the one Frame Separation frames later: when the camera travels, near things slide across the picture more than far ones (parallax), so the more a pixel moves, the nearer it is. Its result goes into a new depth.Z channel; the picture's own channels pass through.

What it needs. A plate where the camera moves sideways, forwards or back. A camera that only pans or tilts on a tripod gives no parallax, and a still camera gives none: everything then comes out at the same depth. Things that move by themselves (people, cars, trees in the wind) look nearer or farther than they are.

Using it.

  1. Connect the plate to Source.
  2. View the node, then pick depth in the viewer's layer list (it appears beside the channel list when the picture has more than one layer). Near is bright with the default Depth Output (1/Z), dark with Distance.
  3. Go to a frame where the camera is moving. If the depth looks flat or noisy, raise Frame Separation (more movement between the two frames); lower it if the picture changes too much between them.
  4. Depth Detail sets how finely the motion is worked out (higher: finer and slower). Smoothness blurs the result; Strength makes the motion itself smoother.
  5. With a tracked camera (a CameraTracker's, or a Camera3D) connected to Camera, the values are real distances in the scene's units; without one they are only relative (nearer and farther, not how far).

It's slow. Each frame works out the motion over the whole picture, so it can't play in real time: with the timeline's real time on, playback skips the frames it can't finish and you see one frame stay. Turn real time off and the timeline steps through every frame; the frames it has worked out are cached and play back quickly after that. A lower Depth Detail is faster.

What it's for. A depth channel for ZDefocus (depth of field), for fog or haze graded by distance, for DepthToPosition (each pixel's place in 3D), or as a soft matte that separates foreground from background.

DepthToPosition

Each pixel's position in the world from its depth and the camera.

Inputs: input, camera (optional, track data).

Setting Default Range or choices What it does
output rgb Where the world positions go: rgb, else the layer's X, Y and Z channels.
depth depth.Z The channel holding the depth.
invert depth off The depth is the distance (off: 1/distance, as rendered).
far 10000 0 to 20000 The distance where the depth is 0.