logo2

  Mattes, Layers, and Groups

 


This note describes two methods of rendering mattes for Massive scenes with AIR, as well as an extension of the second method for rendering by layers or groups.

A Simple RGB Matte Shader

Download:
  rgbmatte.zip

The above archive contains a very simple shader for rendering an “rgb” matte pass in Massive.  Since Massive does not allow an object’s base color to be changed on a per-pass basis, this shader provides parameters for directly setting the output red, green, and blue channels. 

This shader is about as simple as a surface shader can get:

    surface rgbmatte(float r=0; float g=0; float b=0)
    {
      Oi=1;
      Ci=color(r,g,b);
    }

The surface shaders in a scene file can be overridden with the -surf command line switch:

    air -surf rgbmatte myscene.rib

Rendering Mattes using Groups

AIR allows any object to be assigned to one or more groups.  Include an object in a group with

    Attribute” “grouping” “string membership” “+mygroupname”

The objects which appear in each output image can be restricted to members of particular groups by providing a “string subset” parameter with a list of groups in a Display call.  Only objects in the listed groups will appear in the display image; other objects will be treated as matte objects for that image.

These capabilities can be utilized to produce an arbitrary set of mattes for different scene elements in a single render invocation.

Example: say one wanted to render a matte for agents and a matte for terrain. 

Start by creating two small text files, agents.rib, with

Attribute” “grouping” “string membership” “+agents”

and terrain.rib, with

Attribute” “grouping” “string membership” “+terrain”

In Massive assign agents.rib as a custom rib archive to each agent.  Assign terrain.rib as the custom rib archive for the terrain.  Sim and generate the usual set of exported rib files.

The final piece is another small text file defining the matte images for agents and terrain, mattes.rib:

Display “+agent_matte#4f.tif” “file” “a” “string subset” “agents” “quantize” [0 255 0 255]
Display “+terrain_matte#4f.tif” “file” “a” “string subset” “terrain” “quantize” [0 255 0 255]

Include mattes.rib as the options rib in the massive render dialog, or pass it on the command line prior to the main scene file:

air mattes.rib render0001.rib


This method can be used to render a matte for any desired grouping of scene elements.

Rendering Separate Output Images by Group

The above technique easily generalizes to separating any output variable by group.  For example, to render separate beauty images for agents and terrain, use:

Display “+agent_beauty#4f.tif” “file’ “rgba” “string subset” “agents” “quantize” [0 255 0 255]
Display “+terrain_beauty#4f.tif” “file’ “rgba” “string subset” “terrain” “quantize” [0 255 0 255]


See Also:

    Air User Manual:  Output -> Rendering in Layers

 

 

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