Generating a Disparity Map from Depth

To generate a disparity map from a depth channel, do the following:

1.   Start Nuke and press S on the Node Graph to open the Project Settings. Go to the Views tab and click the Set up views for stereo button.
2.   From the Toolbar, select Image > Read to load your stereo clip (usually, a rendered 3D scene) into Nuke. If you don’t have both views in the same file, select Views > JoinViews to combine them, or use a variable in the Read node’s file field to replace the name of the view (use the variable %V to replace an entire view name, such as left or right, and %v to replace an initial letter, such as l or r). For more information, refer to the Nuke User Guide.

Make sure the stereo clip contains a z-depth map for each view in the depth channels. If this is not the case and you have saved the depth maps as separate images, you can use a Nuke Shuffle node (Channel > Shuffle) to shuffle them into the depth channels.

3.   Select Ocula > Ocula 4.0 > O_DepthToDisparity to insert an O_DepthToDisparity node after either the stereo clip or the JoinViews node (if you inserted one in the previous step).
4.   Connect the camera that the scene was rendered with to the Camera input of O_DepthToDisparity. It is important the camera information is correct for the scene.
5.   Open the O_DepthToDisparity controls. From the Views to Use menu or buttons, select which views you want to use for the left and right eye when creating the disparity map.
6.   Attach a Viewer to the O_DepthToDisparity node, and display one of the disparity channels in the Viewer.

O_DepthToDisparity calculates the disparity map and stores it in the disparity channels.

7.   Select Image > Write to insert a Write node after O_DepthToDisparity. In the Write node controls, select all from the channels dropdown menu. Choose exr as the file type. Render the clip.

The newly created disparity channels are saved in the channels of your stereo clip. When you need to manipulate the same clip again later, the disparity vectors are loaded into Nuke together with the clip.

Rendering the output to combine the clip and the disparity
channels for future use.