AIR 6.0 provides a new RI filter plugin capability for modifying the stream of RIB commands before they are processed by the renderer. The current filter is defined using the following attribute:
AIR will search the procedural search path for the filter program. Because the current filter is an attribute, a filter can easily be applied to only a subsection of a scene, say just the agents in a shot. For example, to replace the surface shader assigned to agents one might use the following RIB snippit:
where agents.rib is the agent archive created by Massive. No other scene elements will be affected by the filter.
Sample Filters
echoriblist of RIB commands
The echorib filter accepts a one or more RIB commands as arguments. Any matching commands found in the RIB stream are printed to the terminal on stderr and passed back to the renderer for normal processing.
Echorib is useful for seeing exactly what commands are included in a scene, including those generated by the Massive runprogram procedural primitive. AIR has a -rif command line switch for applying a filter to the whole rib stream. E.g., to see all attributes in a scene:
air -rif “echorib Attribute” myscene.rib
cullriblist of RIB commands
The cullrib filter removes the specifed commands from the command stream before they are processed. For example, to disable all displacements in a scene:
air -rif “cullrib Displacement” myscene.rib
surftoprimlist of parameters
The surftoprim filter takes one or more surface shader parameters as arguments. When the filter encounters a Surface call, it stores any parameters that match the argument list and adds those parameters and values to subsequent primitives as primitive variable data. The Surface call is removed from the RIB stream.
The surftoprim filter allows the agent surface shader to be changed in another program such as Maya or Houdini while retaining the per-agent parameter values generated by Massive. For example, say agents have the VPlastic surface shader assigned in Massive and with a different color map for each agent. The RIB stream produced by the Massive procedural might look something like:
One can then assign the VPlastic shader to a RIB box referencing the filtered agents and manipulate other shader parameters while retaining the color map values generated by Massive. Naturally one can use a different surface shader as well, and any matching primitive variable data will be used. E.g.,
An RI filter is structured similarly to a procedural runprogram. The sample filters are written in C, but any programming language may be used.
When first invoked, the filter should emit a single line containing a list of RIB commands that the filter will process. Then the filter should enter a loop that waits on stdin. Each RIB command will be sent as a single line of potentially very long ASCII RIB. To pass RIB commands back to the renderer, send them to stdout. When the filter is done processing the current command, it should emit a byte value 255. The filter may also need to flush the stdout stream to force all data down the pipe to the renderer.