Deep Compositing Extended

OpenDCX 2.2.2 documentation

Example Nuke Plugins



A Nuke plugin to flatten deep pixel samples into a 2D flat image with subpixel mask and varying surface type support.

This is a customized version of the stock Foundry node and provides support for subpixel sampling via subpixel-mask channels (spmask layer by default). Note: If no subpixel mask channels exist on the input then the standard flattening (legacy) behavior is performed, providing backwards-compatibility for older deep images.

If non-spmask images are merged with spmask images then the non-spmask samples will have spmask channels containing zeros (0). Zero spmask values are interpreted by the flattener as a legacy sample and a full-coverage mask is then used, with the possible result of some aliasing at pixel edges.


Nuke silently inserts a DeepToImage node into the Viewer’s input stream when the Viewer is connected directly to a Deep node.

Because of this behavior this plugin MUST override the stock Foundry DeepToImage plugin otherwise the spmask/flag data will be ignored for deep samples that contain it, likely producing aliased and unpremulted images.

Nuke ships with the DeepToImage code (Documentation/NDK/examples/DeepToImage.cpp) so to compare the output of the stock plugin and the Dcx plugin you can compile the stock plugin with a different node and dso name like ‘DeepToImageFn’ so both plugins can coexist in the same script.

DeepMatte, DeepSurfaceType

_images/DeepMatte.png _images/DeepSurfaceType.png

An example Nuke plugin that sets or clears the per-sample flags.

DeepMatte defaults to setting the Dcx::DeepFlags::MATTE_OBJECT flag, marking the deep samples as matte which will cutout (blacken) objects behind them, including the alpha channel.

DeepSurfaceType exposes all the flag controls allowing the hard-surface, matte-object and additive flags to be changed.



An example Nuke plugin that applies a 2D affine transformation to all deep pixels in the image. If the source deep samples have subpixel masks then they are spatially resampled using the supersampling rate.

If the filter is not impulse and a deep sample has a partial subpixel contribution resulting from the transform then multiple copies of the sample are written to the output deep pixel (which may get combined with another sample) - one with the full subpixel coverage contribution and one or more with the partially-weighted subpixel contributions.

The subpixel masks of these partial samples are mutually exclusive with the full-coverage sample so they never overlap, and are flagged with Dcx::DeepFlags::ADDITIVE and Dcx::DeepFlags::PARTIAL_SPCOVERAGE.

The flattener algorithm accumulates these partial samples additively when combining with full-coverage samples.


This node can replace the stock DeepTransform node with the caveat that the stock node uses an XYZ knob for translate which does not map directly to the new node’s Transform2d_knob XY translate, causing saved Z-translate values to be LOST from pre-existing scripts!

There is no current method (that I’m aware of) to translate a single knob into two separate knobs using the Obsolete_knob mechanism, so these scripts may need to be manually edited to change the translate {<x> <y> <z>} knob entry to translate {<x> <y>}, and move the Z-translate value to the new knob ztranslate <z>. Example:

DeepTransform {
  translate {10.2 0 -23}
  name DeepTransform_Foundry

DeepTransform {
  translate {10.2 0}
  ztranslate -23
  name DeepTransform_OpenDCX



An example Nuke plugin which displays a deep sample’s subpixel mask pattern and also allows it to be set.

Depth, flags and color values for the selected sample are also displayed but cannot be set.

This plugin is primarily intended for debugging purposes.