Friday, June 22, 2012

DPX Plus

Occasionally I hear an After Effects user asking how they can read a DPX that doesn't conform to AE's expectation of a 10-bit RGB file. The DPX spec allows for 8, 10, 12, or 16-bit images, and also supports alpha channels. Since even After Effects CS6 can't read these files, I decided enough was enough and pushed out a free plug-in, which I'm calling DPX Plus. Fortunately this was a pretty easy project thanks to Patrick Palmer's open source DPX library.

When DPX Plus is installed, it becomes AE's default DPX reader, which is not ideal. I'd rather you had to go out of the way to use DPX Plus, but as it stands you have to manually designate AE's internal reader if you don't want your project to rely on a 3rd party plug-in. If you're worried about this, perhaps just use DPX Plus to convert your DPXs to 16-bit PNG or some other format AE can read natively and then remove the plug-in when done.

Enjoy!

Update: DPX Plus now includes Photoshop and Premiere Pro plug-ins as well.

Update 2: DPX Plus can now write DPX files out of Premiere and After Effects.

Update 3: After Effects CC is now shipping with read support for all the DPX varieties that DPX Plus can read. It can also write specific varieties of 8, 10, 12, and 16-bit DPX. Premiere Pro CC can read 16-bit DPX too.

Version: 0.8
Date: 20 December 2012
Mac | Win

Monday, June 4, 2012

dataWindow and displayWindow in OpenEXR files

All OpenEXR files contain two required attributes, dataWindow and displayWindow. Each gives the coordinates for a rectangle, the former describing the pixels stored in the file and the latter describing the viewer that the pixel data lives in. You can see these and other OpenEXR file attributes by viewing the ProEXR File Description in Photoshop.

For a standard OpenEXR file (including all files written by the ProEXR plug-ins), the dataWindow and displayWindow are the same, so you simply have pixels filling the view as you would for regular image files like JPEG or PNG.

But in some cases the dataWindow and the displayWindow may not match. For example, a 3D program with only a small object in the middle of frame might only have to store a 400x400 image within a full 1920x1080 frame, so the dataWindow will be smaller than the displayWindow.

Or an image may be rendered overscan, with pixels that stretch beyond the area you normally view. These pixels might be used if camera shake is added or to provide real edge pixels to use if the image is blurred. So you could have a 2120x1280 image and a 1920x1080 view.
(images borrowed from the Technical Introduction to OpenEXR on OpenEXR.com)

Neither Photoshop nor After Effects have the notion of a display window from the perspective of a file importer, so ProEXR always reads in the full dataWindow, giving you access to all the pixels in the file. But once the file is imported, you can match the displayWindow by floating the Photoshop or After Effects layer inside a differently sized comp. ProEXR includes a Photoshop script and an After Effects plug-in to do the math for you and set this up automatically and precisely.

In Photoshop, run the "ProEXR displayWindow" script, included with ProEXR. It will scan the ProEXR File Description for the window data and automatically enter it into the dialog for you. If you have this information through some other method, you can enter it manually. When you click OK, the Photoshop canvas will be resized so that the original layer floats properly within it, all the original pixels maintained.

In After Effects with the ProEXR AE plug-in installed, select the EXR file and run File > Create ProEXR Layer Comps. In addition to everything this command usually does, a "display comp" will be created that matches the displayWindow and contains the assemble comp floating within it. A display comp will only be created if the displayWindow is different from the dataWindow.

If you have an image sequence in After Effects where the dataWindow changes every frame (perhaps because a small object is being animated), this presents a problem for After Effects, which usually expects every image in a sequence to be the same size. The easiest thing to do is force your renderer to store the whole frame if possible. Otherwise, the way to deal with it is to import the sequence as individual files—select all the files and uncheck the "OpenEXR Sequence" checkbox in the Import Dialog. Then select all these files in your project, hold down option/alt, and go back to the Comp Creator command which will now be renamed "ProEXR DisplayWindow Comp". The result will be a comp with all the files lined up in time, placed inside the comp appropriately. Use this comp as you would a piece of footage.

Update: ProEXR 1.9 for After Effects will handle displayWindow for you without using the Comp Creator.

If you'd like a sample of displayWindow behavior to experiment with, download the file at the bottom of the fnord OpenEXR page.