RSL
AOVs - Secondary Images


return to main index



Introduction

The output of a RenderMan beauty pass is a full colored image displayed in a window, or saved to an image file. In either case, "rgb" or "rgba" data is "piped" through the primary display channel using the rib Display statement.

    Display "PATH/untitled.tif" "tiff" "rgba"


Figure 1

With prman 12.0 the DisplayChannel statement was introduced. It enables variables (arbitary output variables or AOV's) that store any RSL numeric data to be associated with their own "pipe" or so-called secondary display channel. For example, a secondary image that displays the t texture coordinate can be generated with the following two rib statements.

    DisplayChannel "float t" "quantize" [0 0 0 0] "dither" [0]
    Display "+PATH/untitled_t.tif" "tiff" "t"

The two Display statements shown above were used to generate the following images.


Figure 1


Rib files generated by Pixar's mtor plugin have 42 pre-defined DisplayChannel statements that enable 17 of the renderers primitive variables (P, N, s, t etc) and 32 shader output variables to be automatically referenced as sources of data for secondary images.


Mtor Predefined Display Channels


Primitive Variables Shader Output Variables
 color Ci
 color Cs
 color Oi
 color Os
 float s
 float t
 float u
 float v
 normal N
 normal Ng
 point P
 vector E
 float du
 float dv
 vector dPdtime
 vector dPdu
 vector dPdv
 color Ambient
 color Backscattering
 color DiffuseColor
 color DiffuseDirect
 color DiffuseDirectShadow
 color DiffuseEnvironment
 color DiffuseIndirect
 color Incandescence
 color OcclusionDirect
 color OcclusionIndirect
 color Refraction
 color Rim
 color SpecularColor
 color SpecularDirect
 color SpecularDirectShadow
 color SpecularEnvironment
 color SpecularIndirect
 color Subsurface
 color Translucence
 color _Ci
 color _Oi
 color _albedo
 color _color
 color _diffusemeanfreepath
 color _indirectdiffuse
 color _radiance_t
 color _radiosity
 float __CPUtime
 float _area
 float _float
 float _occlusion
 vector_environmentdir

DisplayChannel's also enable data to be saved to a point cloud (.pct) file. Listing 1 shows how mtor (version 7) listed its DisplayChannel statements at the head of a rib file.


Listing 1


DisplayChannel "color Ambient" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color Backscattering" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color Ci" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color Cs" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color DiffuseColor" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color DiffuseDirect" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color DiffuseDirectShadow" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color DiffuseEnvironment" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color DiffuseIndirect" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color Incandescence" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color OcclusionDirect" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color OcclusionIndirect" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color Oi" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color Os" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color Refraction" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color Rim" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color SpecularColor" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color SpecularDirect" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color SpecularDirectShadow" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color SpecularEnvironment" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color SpecularIndirect" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color Subsurface" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color Translucence" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color _Ci" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color _Oi" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color _albedo" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color _color" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color _diffusemeanfreepath" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color _indirectdiffuse" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color _radiance_t" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "color _radiosity" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "float __CPUtime" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "float _area" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "float _float" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "float _occlusion" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "float du" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "float dv" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "float s" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "float t" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "float u" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "float v" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "normal N" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "normal Ng" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "point P" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "vector E" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "vector _environmentdir" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "vector dPdtime" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "vector dPdu" "int[4] quantize" [0 0 0 0] "float dither" [0]
DisplayChannel "vector dPdv" "int[4] quantize" [0 0 0 0] "float dither" [0]


Quantization

Within the renderer, data such as floats, the rgb components of colors and the xyz values of points, vectors and normals are stored with floating point precision. When saving such data into an 8 bit per channel tiff file it is necessary to convert the floating point data into integer values - a process known as quantitization.

    DisplayChannel "float t" "quantize" [0 0 0 0] "dither" [0]
    Display "+PATH/untitled_t.tif" "tiff" "t" 
            "quantize"  [0 255 0 255] "dither" [0.5]

Without any quantization the output image would be a 32bit/channel (4,294,967,296 values per channel) tiff file ie.

    Display "+PATH/untitled_t.tif" "tiff" "t" 
            "quantize"  [0 0 0 0] "dither" [0.0]

Or a 16bit/channel (65,536 values per channel) tiff file ie.

    Display "+PATH/untitled_t.tif" "tiff" "t" 
            "quantize"  [0 65535 0 65535] "dither" [0.0]

For an excellent explanation of quantization refer to page 41 of "Advanced RenderMan" by Tony Apodaca and Larry Gritz. Also refer to,

    Using Arbitrary Output Variables in PhotoRealistic Renderman
     - prman_technical_rendering/AppNotes/appnote.24.html

Generating a secondary image that "encodes" a primitive variable is straight forward because such variables are inherently known to the renderer. This is not true for shader output variables or AOV's (arbitary output variables). For example, figure 2 shows a secondary image (render pass) that contains "_specular" data.


Figure 2


Only by rendering the teapot using a shader that assigns values to a variable that it declares as,

    output varying color _specular = 0;

and that also specifies a DisplayChannel in the rib file as...

    DisplayChannel "color _specular" "quantize" [0 0 0 0] "dither" [0]

can a secondary image (pass) be generated. Alternatively, if Pixar's Slim is used to make a shading network an AOV can be outputted that way. Whether a hand coded or Slim generated shader is used unless it declares an output varying variable, and of course assigns values to the variable, can data be "piped" through a secondary display channel. For example, it would be futile to attempt to output a secondary image containing specular data using the classic "plastic" shader because it does not assign specular values to an output variable. The shader shown in listing 2 outputs specular data through an AOV named _specular.


Listing 2


surface
spec_out(float  Ks = 0.7,               
                roughness = 0.1;
         color  hilitecolor = 1;
output varying color _specular = 0)
{
normal  n = normalize(N);
normal  nf = faceforward(n, I);
  
Oi = Os;
  
vector  i = normalize(-I);
_specular = Ks * specular(nf, i, roughness)
               * hilitecolor;
Ci = Oi * Cs * _specular;
}

The shader shown in listing 3 uses an output varying variable to "pipe" data into a point cloud.


Listing 3


surface
bake_out(float  Ks = 0.7,               
                roughness = 0.1;
         color  hilitecolor = 1;
        string  channel = "",
                bakefile = "")
{
normal  n = normalize(N);
normal  nf = faceforward(n, I);
  
Oi = Os;
  
vector  i = normalize(-I);
color spec = Ks * specular(nf, i, roughness) 
                * hilitecolor;
if(bakefile != "")
    bake3d(bakefile, channel, P, n, "_specular", spec);
Ci = Oi * Cs * spec;
}


A rib file that uses the "bake_out" shader might do so in this way.

    Surface "bake_out" "channel" ["_specular"] 
            "bakefile" ["spec.ptc"]


Figure 3
Specular data stored in a point cloud




© 2002- Malcolm Kesson. All rights reserved.