logo2

  Display Customization and Multipass Rendering

 


The output image or images generated by a rendering are defined by one or more Display calls in a scene file.  The Render dialog in Massive allows you to set up a single Display call that will generate an 8-bit image with 4-channel output (rgba).  This standard output can be customized and enhanced with the use of additional rib commands in an auxilliary text file that is passed to the renderer prior to the main scene file.

Quantization for the Main Display

The output data type for the main display call can be changed from 8-bit to 16-bit or floating-point using the Quantize rib command.  For 16-bit data (quant16.rib):

    Quantize "rgb" 65535 0 65535 0.5
    Quantize "rgba" 65535 0 65535 0.5

For floating-point data (quantfloat.rib):

    Quantize "rgb" 0 0 0 0
    Quantize "rgba" 0 0 0 0

A sample command to render 16-bit output might be:

    air quant16.rib scene.rib

When rendering 16-bit and floating-point images be sure to use a file format that supports the corresponding data type.  16-bit images are supported by the PNG, PSD, SGI and TIFF formats.  Floating-point data is supported in the TIFF, OpenEXR, and HDR formats.  AIR Show can display images with 8-bit, 16-bit, or floating-point data.

Multipass Rendering with Multiple Displays

AIR provides two complementary features that enable multipass rendering:

1.  Multiple images can be produced from a single rendering by providing additional Display calls with the file name prepended with a +.

2.  Any output variable from a surface shader can be saved in an image.

Most AIR surface shaders provide a standard set of color output variables:

    __ambient
    __diffuse
    __specular
    __reflect
    __refract
    __incandescence

__diffuse is further broken down into:

    __diffuse_unshadowed
    __shadow
    __indirect

These extra output variables (also sometimes referred to as arbitrary output variables or AOVs) can be saved using an appropriate Display call.  A sample rib file that saves diffuse and specular passes in addition to a beauty image would look like:

    Display "mp_beauty.tif" "file" "rgba"
      "quantize" [0 255 0 255]
    Display "+mp_diffuse.tif" "file" "varying color __diffuse"
      "quantize" [0 255 0 255]
    Display "+mp_specular.tif" "file" "varying color __specular"
      "quantize" [0 255 0 255]
    Option "render" "commands" "-Display"

The last line is important: it tells AIR to ignore subsequent Display calls in the RIB stream. Save the above to a text file, say displays.rib, then render with

    air displays.rib massivescene.rib

You can save 16-bit or floating-point data instead of 8-bit data by changing the "quantize" parameters.  For 16-bit output:

    "quantize" [0 65535 0 65535]

For floating-point output:

    "quantize" [0 0 0 0]

The frame number can be included in a Display call with #nf where n is the number of digits. E.g.,

    Display "beauty_#4f.tif" "file" "rgba"

would render to

    beauty_0021.tif

for frame 21.

Adding a Frame Block

There is one catch with frame number expansion and Massive ribs prior to the 3.5 release of Massive:  Massive rib files did not include a Frame block that sets the frame number.  To deal with this problem, we have a written a small utility available here to add a frame block to a sequence of files.  If you are using Massive 3.5 or later, frame number expansion should work with the unaltered RIB files generated by Massive.

Alternatively, on Linux the render script generated by Massive can be modified to include a frame block as follows:

#!/bin/csh -f

set f = 60
while ($f <= 65)
echo $f
air displays.rib "{" `printf "FrameBegin %d" $f` "}" `printf "./Rib/render%04d.rib" $f` "{FrameEnd}"
@ f++
end
echo "Render complete"

Naturally the frame range - 60 to 65 in this example - and scene file name are changed as appropriate.

Multiple Outputs in a Single Image

Instead of generating a separate image for every output variable, multiple output values can be saved in a single file to formats such as TIFF, OpenEXR, and PSD that support more than 4 channels per image.  To save more than one value in a single image, provide a comma-separated list of output variables in the Display call.  For example:

    Declare “__diffuse” “varying color”
    Declare “__specular” “varying color”

    Display “multi.psd” “file” “rgba,__diffuse,__specular”

Display Templates

Here are 3 template files with Display calls for rendering 8-bit, 16-bit, and floating-point output: 

These templates can be customized by adding or removing # symbols at the beginning of Display lines to enable or disable the corresponding output image. 

As-is the templates render TIFF files.  Change the extension of the image file name to select a different image format.  To render to AIR Show, change the output driver name from file to framebuffer.
 

 

© 2001-13 SiTex Graphics, Inc.  All rights reserved.