Args Files

Args Files

What Is An Args File?

Args files are XML files that provide the user interface for shader parameters. RenderMan for Maya converts an Args file to a .slim file automatically. RenderMan for Katana looks for Args files in one of the following directories:

  1. Args subdirectory of the shader directory. This is recommended.
  2. ../Args directory relative to the shader directory.
  3. Args subdirectory of $KATANA_RESOURCES.

Args files are optional for RSL shaders. If there is no Args file provided, the original shader parameter names will be displayed. Args files are required for RIS shaders; they are the only source for information about the shader parameter types, defaults, etc. The name of the Args file must have the same base name as the shader, e.g. PxrBump.args for PxrBump.so, KatanaPhong.args for KatanaPhong.slo, 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, for an existing Args file, some aspects the user interface can be edited interactively then export the changes of 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:

<args format="1.0">
    <param name="someParameter"/>
    <param name="anotherParameter">
</args>

Shader Type

PRMan extension

The type of shader is specified using the shaderType element (formerly known as the typeTag element). This is necessary for RIS shaders as there is no sloinfo mechanism by which to query the shader type. サンプル are:

<shaderType>
    <tag value="pattern"/>
</shaderType>

<shaderType>
    <tag value="bxdf"/>
</shaderType>

RSL light shaders intended as geometric area lights or environment lights requiring the "envsphere" geometry must specify an additional detail hint to the RenderMan for Katana plugin:

<shaderType>
    <!-- Output RIB specific to geometric area lights -->
    <tag value="light" detail="geoAreaLight"/>
</shaderType>

<shaderType>
    <!-- Generate ジオメトリ "envsphere" RIB output -->
    <tag value="light" detail="envAreaLight"/>
</shaderType>

Basic Elements

param

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.

page

Parameters may be grouped into pages via page properties, either as a stand-alone page or nested via dot-delimited values:

<param name=“someParameter” page=“ライティング” />
<param name=“anotherParameter” page=“ライティング.Advanced”/>

Page grouping may also be specified via enclosing page elements:

<page name="ライティング">
    <param name=“someParameter”/>
    <page name="Advanced">
        <param name=“anotherParameter”/>
    </page>
</page>

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:

<page name="Advanced" open="True">
    <param name=“anotherParameter”/>
</page>

help

Embedded documentation may be specified with either a property or a child element of type help

<param name=“someParameter” help=“This parameter increases render time.”/>

When using a child help element, its contents are interpreted as XHTML for more sophisticated formatting.

<param name=“anotherParameter”>
    <help>
        <p>
        This parameter is <b>very</b> important.
        </p>
        <i>Please be careful when setting it.</i>
    </help>
</param>

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

Comments are the same as they are in HTML and XML:

<!-- Useful commentary goes here. -->

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.

Parameter Definition

Details about each param element can be specified using the following properties:

Parameter Properties
Property Description Requirement Origin
name Specifies the exact shader parameter as in .slo and .so. Required Katana
label String to display in the UI for the parameter. If no label is specified the name of the parameter is used. Optional Katana
type The parameter type. Recognized types are: float, int, string, color, normal, point, matrix, shader, vector, struct, and bxdf. Required for RIS shaders in RfM. PRMan extension
default Specifies default parameter value. Note: setting the default for RSL shaders in Katana is not needed since the default is read from sloinfo. Required for RIS shaders Katana
coshaderPort Set to "True" if the parameter takes a co-shader. Optional Katana
coshaderPair

Specify the co-shader shader parameter that is being paired with the non-co-shader parameter:

<param name="diffuseカラー"
       coshaderPair="diffuseカラーCoshader"/>
<param name="diffuseCoshader"
       coshaderPort="True"/>
Optional Katana
arraySize

Specify the array size. Default values are separated by spaces.

<param name="rman__ProceduralResolution" type="float" arraySize="2"
 default="1024 1024"/>
Optional Katana
isDynamicArray

Set to "1" if the parameter is a dynamic array.

<param name="layers" isDynamicArray="1"
       arraySize="-1" widget="dynamicArray"/>
Optional Katana
widget 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 default or none 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 int Default widget used for numeric parameter types. Common hints are listed below. min, max, sensitivity, int, slider, slidermin, slidermax
String string Default widget for string parameters. replaceRegex, replaceWith
Boolean boolean A dropdown list with "Yes" and "No" options. None
Check Box checkBox Boolean parameter displayed as a check box rather than a pop-up. None
Popup/Selector popup A pop-up menu or combo box with literal choices for paramter values. options, editable
Mapping Popup mapper A pop-up menu with associative choices. Each value has an associated display value. options, hintdict
カラー 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 fileInput A file parameter where a file browser icon will be available to pick a file. typefilter, presets, fileType. In addition RfM supports the options="texture" option for automatically running txmake.
Null/Hidden null Hide the parameter from the user interface. None

Widget Type サンプル

<param name="diffuseカラー" widget="default"/>

<param name="channel" type="string" widget="popup" options="R|G|B|A"/>

<param name="stops" label="Stops" type="float"
       default="0.0" min="-10" max="10"
       slider="True" slidermin="-4" slidermax="4"
       widget="float">

<param name="atlasStyle" type="int" default="0" widget="mapper">
    <hintdict name="options">
        <string name="None"   value="0"/>
        <string name="MARI"   value="1"/>
        <string name="Mudbox" value="2"/>
    </hintdict>
</param>

Input and Output Tags

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 name="resultRGB">
    <tags>
        <tag value="color"/>
        <tag value="diffuse"/>
    </tags>
</output>

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:

<param name="inputDiffuse" type="color" widget="default">
    <tags>
        <tag value = "diffuse"/>
    </tags>
</param>

Tag values can be any valid output connection string. Boolean logic is also available for more advanced rules about input connection validity:

<param name="inputDiffuse" type="color" widget="color">
    <tags>
        <tag value = "(diffuse and color) or struct"/>
    </tags>
</param>

Connections are disabled by setting connectable="False"

<param name="invertT"
       type="int"
       widget="checkBox"
       connectable="False">
</param>

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/RIS/pattern/Args/PxrMix.args

parseArgs will output a list of parameters and their attributes that are supported in RenderMan for Katana and Maya.


Sample Args File

The PxrMix.args file (for PxrMix.so shader) is provided as an example, to provide more information about the structure of the file:

<args format="1.0">
    <shaderType>
        <tag value="pattern"/>
    </shaderType>
    <help>
        This node mixes two colors according to the
        given mix percentage. A mix value of 0 results in カラー 1.
    </help>
    <param name="color1"
        label="カラー 1"
        type="color"  default="0. 0. 0."
        widget="color">
        <tags>
            <tag value="color"/>
        </tags>
    </param>

    <param name="color2"
        label="カラー 2"
        type="color"  default="1. 1. 1."
        widget="color">
        <tags>
            <tag value="color"/>
        </tags>
    </param>
    <param name="mix"
        label="Mix"
        type="float"  default="0."
        min="0" max="1" widget="default"  tag="float">
        <tags>
            <tag value="float"/>
        </tags>
    </param>

    <output name="resultRGB">
        <tags>
            <tag value ="color"/>
            <tag value ="vector"/>
            <tag value ="normal"/>
            <tag value ="point"/>
        </tags>
    </output>
    <output name="resultR">
        <tags>
            <tag value ="float"/>
        </tags>
    </output>
    <output name="resultG">
        <tags>
            <tag value ="float"/>
        </tags>
    </output>
    <output name="resultB">
        <tags>
            <tag value ="float"/>
        </tags>
    </output>
</args>