This document focuses on Katana usage as a practical example.
What Is An Args File?
Args files are XML files that provide the user interface for shader parameters. RenderMan for Katana looks for Args files in one of the following directories:
- Args subdirectory of the shader directory. This is recommended.
- ../Args directory relative to the shader directory.
- Args subdirectory of $KATANA_RESOURCES.
Args files are required for plugin (C++) shaders; they are the only source for information to the DCC about the shader parameter types, defaults, etc. (Note, however, that RenderMan itself does not read the Args file; it gets this information from the parameter table of the shading plugin). The name of the Args file must have the same base name as the shader, e.g. PxrBump.args for PxrBump.so, PxrRectLight.args for PxrRectLight.so, etc. The order of the shader parameters in the Args file represents the order in which they will appear in the user interface.
How To Create An Args File
An Args file is an ASCII file that can be created manually using any text editor.
Note: If you are using RenderMan for Katana some aspects the user interface can be edited interactively then exported to the Args file. Refer to the documentation in your Katana installation for more details ($KATANA_HOME/docs/pdf/ArgsFiles.pdf).
Args File Format
The basic format for an args file is as follows:
The type of shader is specified using the shaderType element. This is necessary for plugin shaders as there is no mechanism by which to query the shader type. An example for a pattern plugin would be:
Elements of type param describe the presence and order of parameters within the shader UI. Each param element is required to have a name property; all other properties are optional. See below for a detailed list of param properties.
Parameters may be grouped into pages via page properties, either as a stand-alone page or nested via dot-delimited values:
Page grouping may also be specified via enclosing page elements:
Parameters within a page group are collected in the UI under a group widget pane that can be "open" or "closed". By default the group is closed but this behavior can be modified using the open property on the page element:
Embedded documentation may be specified with either a property or a child element of type help:
When using a child help element, its contents are interpreted as XHTML for more sophisticated formatting:
Both forms are also supported on args and page elements. For more details on embedded documentation and other features of the help element please see the Args File UI Hinting document.
Comments are the same as they are in HTML and XML:
Elements and Properties
Args files were originally created as a way of providing UI hinting for shaders in Katana. PRMan has since adopted and extended this format. Katana's set of elements, parameters and tags are described in detail in the Katana documentation and in the Args File UI Hinting document. Below is a summary of the most commonly used components for the built-in PRMan shaders. Portions that have been adopted specifically for PRMan and RenderMan for Katana and Maya are noted.
Details about each param element can be specified using the following properties:Parameter Properties
|Specifies the exact shader parameter.||Required||Katana|
|String to display in the UI for the parameter. If no label is specified the name of the parameter is used.||Optional||Katana|
|The parameter type. Recognized types are: float, int, string, color, normal, point, matrix, vector, struct, bxdf, lightfilter, displayfilter, and samplefilter.||Required for plugin shaders in RfM.||PRMan extension|
Specifies default parameter value. For color, point, normal, and vector, three values are required. For array size > 1, default values are separated by space. Examples:
type = "float" default = "5.0".
type = "color"", default="0.18 0.18 0.18"
type = "normal" default="0 0 0"
type = "float" arraySize = "5" default = "15.0 25.0 8.0 5.0 40.0"
type = "color" arraySize = "2" default = "0.18 0.18 0.18 0.18 0.18 0.18"
For dynamic array, since the array size is unknown, specifying the default values will not work.
|Required for plugin shaders||Katana|
Specify the array size. Default values are separated by spaces.
<param name="resolution" type="float" arraySize="2" default="1024 1024"/>
Set to "1" if the parameter is a dynamic array. Note that default for dynamic array must not be specified.
<param name="layers" isDynamicArray="1" arraySize="-1" widget="dynamicArray"/>
|The widget property specifies which user interface widget should used for a parameter. If no widget type is defined the widget will default to a numeric type. The standard widget types are defined below.||Optional||Katana|
The following table is a list of the commonly used widget types for RfM and RfK. There are several other widget types defined by Katana which are recognized by RfK but they are not currently recognized by RfM. The table includes a list of commonly-used hints for each widget types. Please see Args File UI Hinting for detailed explanations of these and other available hints.List of Common Widget Types
|Widget Type||Tag Name||Description||Common Hints|
|Default||Each parameter type has a default widget type. If the widget type is not specified in the args file it will be determined by the shader parameter data type.||None|
|Numeric||Default widget used for numeric parameter types. Common hints are listed below.|
|String||Default widget for string parameters.|
|Boolean||A dropdown list with "Yes" and "No" options.||None|
|Check Box||Boolean parameter displayed as a check box rather than a pop-up.||None|
|Popup/Selector||A pop-up menu or combo box with literal choices for paramter values.|
|Mapping Popup||A pop-up menu with associative choices. Each value has an associated display value.|
|Color||A color parameter where a color picker will be available to pick a color. Note that in Katana, the color picked will return a linearized RGB value.||None|
|File Input||A file parameter where a file browser icon will be available to pick a file.|
|Null/Hidden||Hide the parameter from the user interface.||None|
|Float Ramp||floatRamp||Float ramp editor. Require_Knots, _Floats, and _Interpolation for the parameter. See example below.||None|
|Color Ramp||colorRamp||Color ramp editor. Require _Knots, _Colors, and _Interpolation for the parameter. See example below.||None|
|Asset Input||assetIdInput||An asset browser for selecting an input. Use with options="texture". See example below.||None|
Widget Type Examples
Input and Output Tags
Katana requirement: All input and output tag values must be all lowercase.
Each shader can define a set of outputs in the args file. In addition each parameter of a shader can define what types of input are allowed.
Output connections are specified using the output element with a series of tags enumerating the output types:
Output tag values can be any string, but in order for Katana to recognize them as valid outputs the value string must be all lowercase and each tag value must be specified on a separate line.
Input connections are defined as a tags child element of param:
Tag values can be any valid output connection string. Boolean logic is also available for more advanced rules about input connection validity:
Connections are disabled by setting connectable="False"
Please see the Katana Technical Guide section on Typed Connection Checking for more details about input/output tags and input connection boolean logic.
Parsing Args Files
PRMan uses RapidXML for parsing Args files. See $RMANTREE/lib/examples/args/parse/parseArgs.cpp for an example of a standalone C++ program to parse an .args file. To build this program on Linux, for example, run:
make -f Makefile.linux parseArgs $RMANTREE/lib/plugins/Args/PxrChecker.args
parseArgs will output a list of parameters and their attributes that are supported in RenderMan for Katana and Maya.
Sample Args File
The PxrChecker.args file (for PxrChecker.so shader) is provided as an example, to provide more information about the structure of the file: