The OpenEXR format has a number of useful features which are super handy for CG animation and VFX such as saving the image data in either half or full floating point, setting data-windows and adding additional metadata to the the file. 3Delight for Maya allows you to use all these features, but doesn’t cover how to use them in the documentation (at least I couldn’t find mention of it).
In order to use gain access to these features you need you need to add an extra attribute to the render pass called “exrDisplayParameters”. In the example below, the name of my render pass is called “beauty”.
addAttr -dt "string" -ln exrDisplayParameters beauty; setAttr "beauty.exrDisplayParameters" -type "string" "-p \"compression\" \"string\" \"zip\" -p \"autocrop\" \"integer\" \"1\" ";
The string attribute should end up looking like so in the attribute editor…
-p "compression" "string" "zip" -p "autocrop" "integer" "1"
The above sets the compression type to zip and to also tells 3Delight to autocrop the image when it’s rendered. Auto-crop adjusts the bounding box of the data-window (or ROI, region-of-interest) to only contain non-black pixels (I believe it does this based on the alpha channel), this allows Nuke to process the image quicker as it only calculates information within that data-window. See this tutorial on Nuke Bounding Boxes and how to speed up your compositing operations.
The basic syntax of the parameter string is easy enough to understand, the three arguments passed to the -p flag are name, type and value.
-p "[name]" "[type]" "[value]"
You can also add additional metadata to the header of the EXR render. For example you may wish to include things such as
- Project, scene and shot information.
- Characters or creatures in the shot.
- Model, texture, animation versions used.
- Maya scene used to render the shot.
- Focal length, Fstop, Shutter Angle, Filmback size.
3Delight already includes some metadata already with the EXR, so you don’t need to add information for the following…
- Near and far clipping planes.
- WorldToCamera and WorldToNDC matrices. The Nuke Python documentation has info on how you can use this to create cameras in Nuke based of this data.
You can add this metadata using the “exrheader_” prefix and then the name of your attribute. The following will add three metadata attributes called “shutter”, “haperture” and “vaperture”.
-p "exrheader_shutter" "float" "180" -p "exrheader_haperture" "float" "36" -p "exrheader_vaperture" "float" "24"
While the following will add the project name “ussp” and the maya scene name that was used to render the shot…
-p "exrheader_project" "string" "ussp" -p "exrheader_renderscene" "string" "h:/ussp/bes_0001/scenes/lighting_v01.ma"
The easiest way to get information from your scene to this parameter pass is to set up a Pre-Render MEL script in your render-pass along the lines of…
string $sceneName = `file -q -sn`; //Grab the name of the current scene. string $projectName = `getenv "PROJECT"`; //This assumes you have an environment variable called "PROJECT" with the project name setup already. string $parameters = ""; $parameters += (" -p \"exrheader_renderScene\" \"string\" \"" + $sceneName + "\" "); $parameters += (" -p \"exrheader_projectName\" \"string\"" + $projectName + "\" "); setAttr ($pass + ".exrDisplayParameters") -type "string" $parameters;
See the 3Delight documentation has more information on what type of metadata you can add to the EXR.