This weekend, I used Renderman's Arbitrary Output Variable (AOV) capability to render additional information, and use it two different ways in a composite.
Demonstrated here is a selective Depth output channel.
Application
Problem: If you have a shot that requires Render Layers in compositing, you will need to re-render the scene for each layer. Renderman's AOV capability allows rendering arbitrary information in a single render, and outputting to multiple files.
In the following example, I'm using an old (and primitive) scene just to demonstrate the shader, not the lighting or materials. The great advantage to this technique is that AOVs can easily be added to specific shaders. In a practical scenario, complex shaders would already be set up, and this AOV could be added the the shaders (in source) to easily control secondary output.
Adding Arbitrary Output Variables
First, we build the RSL shader that adds secondary output functionality. Here's what needs to be added (The entire shader is availablefor download too):
output varying float _depth = 0;
output varying float _zmask = 1;)
_depth = depth(P);
_zmask = 1;
Next, we have to make sure that the rendered RIB adds the extra output,
Here's what we're looking to add the the RIB that gets rendered:
DisplayChannel "float _depth"
DisplayChannel "float _zmask"
Display "AOVrender.0001.tif" "tiff" "rgba" "int[4] quantize" [0 255 0 255] "float dither" [0.5]
Display "+AOVrender._depth.0001.tif" "tiff" "_depth" "int[4] quantize" [0 0 0 0] "float dither" [0]
Display "+AOVrender._zmask.0001.tif" "tiff" "_zmask" "int[4] quantize" [0 255 0 255] "float dither" [0.5]
Adding the AOVs in Maya
I used Renderman for Maya for my scene, so here's how I added the options in Maya
1. Use RiDisplayChannel to add the display channels

2. Add the output channels here, based on the name of the AOV

Compositing
Here are the three render channels generated, and the composite:
(_zmask, _depth, beauty, composite; from top left to bottom right)
 
 
Note: All objects have _depth AOV shaders except the foreground lamp, sky, and the glass windows, who have _depth turned off in the shader, not a maya render layer!
The advantage to having a "_zmask" output allows objects to not be depth blurred. I disabled "_depth" in the shader for the lamp here to prevent artifacts from fake Depth of Field, and to draw foreground focus:

Below is the Nuke script.
Two ColorCorrect nodes were used to control AtmosphereDensity and AtmosphereDepth

Left: AtmosphereRange Right: AtmosphereDensity
 
Final Thoughts
AOVs are an amazing capability of Renderman. The only downside is that they must be coded into each shader, which is not practical when using Maya shaders.
The final composite, as seen above.
|