Deep Compositing Extended

OpenDCX 2.2.2 documentation

Example Commands


These example commands are provided solely to illustrate methods of using the Dcx API. They are not intended to be used (or particularily useful) in a production environment and are subject to change at any time!


readDeepPixelExample is a simple deep exr reader that uses the DeepTile & DeepPixel functions to get and print DeepSegment info for deep pixels.

usage: readDeepPixelExample [options] infile

Print info about a deep pixel or line of deep pixels

  -pixel <x> <y>  print a single deep pixel
  -line <y>       print all deep pixels on line
  -nomask         don't print subpixel mask patterns

  -h              prints this message


deepFlattenExample is an example use of OpenDCX to read a deep exr, flatten each deep pixel and write out to a flat exr.

usage: deepFlattenExample [options] infile outfile

Flattens a deep input exr producing a flat output exr.

  -v         print additional info
  -h         prints this message


deepTransformExample is an example use of OpenDCX to read a deep exr, transform it in 2D and write out to another deep exr.

Leverages the Dcx::DeepTransform class’ subpixel mask resampling functionality to allow fractional pixel transforms to be applied without losing subpixel masks or flags metadata.


Speed & Threading:

This example routine as written is single threaded, but in backwards-mode it’s relatively easy to spawn multiple threads to work on separate output scanlines simultaneously. This is thread safe as long as the Dcx::ChannelContext is shared between the threads and the scanlines are written to the output file in order.

In forwards-mode multiple threads can be adding deep samples into the same DeepImageOutputTile::Deepline, so a locking mechanism is required. DeepImageOutputTile does not offer one built in.

usage: deepTransformExample [options] infile outfile

Applies a 2D transform to an OpenEXR deep image
Reads the input file line by line applying the 2D transform and writing to output file.
Example use of the OpenDCX DeepTransform class and the resampling of subpixel masks to
provide fractional-pixel filtering while preserving the subpixel mask functionality.

Mask resampling options:
  -f <mode>        resample mask mode ('nearest', 'box') (default=box)
  -ss <int>        mask super-sampling factor (default=4)

Transform options:
  -t <x> <y>       translate            (default=0.0,0.0)
  -s <x> <y>       scale                (default=1.0,1.0)
  -r <deg>         rotation in degrees  (default=0.0)
  -c <x> <y>       rot/scale center     (default=0.0,0.0)
  -m <mode>        pixel-loop order 'bwd' or 'fwd' (default=bwd)

Info options:
  -ininfo  <x> <y>  print input deep pixel info
  -outinfo <x> <y>  print output deep pixel info

  -v               print additional info
  -h               prints this message


raySampleAccumulatorExample converts input deep pixels into sphere primitives which are ray traced multiple times at each output pixel producing deep pixels with subpixel masks.

This is a very simple and naive example of collapsing (accumulating) subpixel ray intersections together to form a single output deep sample with an accumulated subpixel mask.

usage: raySampleAccumulatorExample [options] infile outfile

Converts input deep pixels into sphere primitives which are ray traced multiple
times at each output pixel producing new deep pixels with subpixel masks.

  -skip <n>       read every nth input pixel when creating spheres (default 8)
  -scale <v>      globally scale of sphere radius (default 40.0)

  -sp <v>         xy subpixel sampling rate (default 16)
  -spX <x>        x subpixel sampling rate (default 16)
  -spY <y>        y subpixel sampling rate (default 16)
  -zthresh <v>    z-distance threshold for combining samples

  -camt <x><y><z> camera translation (default input image w/2,h/2,w)
  -camr <x><y><z> camera rotation (default 0,0,0)
  -camfl <v>      camera focal-length (default 50.0)
  -camha <v>      camera horizontal aperture (default 24.0)

  -apwin <x><y><r><t> camera aperture in pixels (default is input displayWindow)

  -v              print additional info
  -h              prints this message