A video that shows rendering workflows with Arnold Operators can be found here.
Operators allow advanced users to override any part of an Arnold scene and modify the Arnold universe at render time. Probably one of the most common use cases is to override parameters (e.g. shaders) inside a procedural (e.g. ASS or Alembic). To achieve this you must know the Arnold node and parameter names defined inside the procedural.
Operator nodes perform per-object (node) parameter assignments and overrides, including late-bindings and deferred overrides on procedurally generated nodes. Operators can also create nodes (MaterialX) and carry out general scene inspection and modifications.
Some Operators provide a selection parameter that determines, using a wildcard expression, which nodes are processed by the operator. This is discussed in more detail in the section on selection expressions below. If an operator is being evaluated with regards to a procedural it's connected to the selection expression is assumed to be relative to the procedural's namespace (see operator graphs below).
Operators can be chained together in an operator graph which is evaluated from a given target operator. Multiple disconnected operator graphs can exist in the scene, where only the graph connected to the target operator and operator graphs connected to procedural nodes will be evaluated for rendering.
Kick can be used to query possible target node parameter names of a set_parameter node. For example:
kick -info <node type>
kick -info polymesh
Operators can be ignored in the Arnold render settings by ticking Ignore Operators in the Diagnostics tab.
Arnold Operators can be imported and exported by right-clicking on the Arnold output.
Tutorials about Operators can be found here.
Example use of Operators in HtoA
In HtoA, Operators are exposed as ROP nodes. Connect an Operator chain as an input of an Arnold ROP to apply the Operator chain when rendering from that ROP.
An operator can use a selection to determine what nodes will be selected to be processed by the operator at render time. The selection is an expression that can consist of multiple selections concatenated by:
()for nested scoping
Each selection uses glob patterns and regular expressions and a node will be processed by the operator if the expression matches the node name. By default glob matching is used unless the selection is in a regex quote, i.e.
r'<my_regex>'. For example:
Selections can also be used to match parameter names and values on the selected nodes, including the node entry name, type, and derived type. This is done using a parameter dot-delimiter
.() on each node selection string. The following example selection matches all nodes named '
sphere' which have a '
Comparators can be used to match certain parameter values. The following selection matches all nodes whose name starts with 'sphere' and has a 'radius' larger than 0.5:
The parameter matching also supports concatenation and glob/regex, e.g.:
Arrays and multi-value parameters such as vectors, RGB, etc. are matched using square brackets. If an array has a single value or if the array consists of single numbers then only one set of square brackets is necessary.
Matching parameters of type string, enum and node requires string literals, e.g.:
Note: The value will be treated as a parameter reference if the string quotes are omitted (see below).
It is possible to match specific array indices in array and multi-value parameters. Square brackets are not necessary when matching a single value:
Commonly, the node already has some arbitrary user parameters coming from e.g. simulation or even another operator.
It is possible to match other node parameters of the same type, e.g.:
Node parameters can match single string values, e.g. to match a shader based on a user string parameter:
We can also match parameters on other nodes, where the syntax is
It can be useful to match values on parameters that are linked to the node. Shaders are a common example, where the value can also refer to other parameters:
We can also match more than one parameter by using a glob or regex expression in the parameter name.
A simple example is matching an RGB parameter regardless of if it's called color or colour:
The operator is given all the parameters that matched where it can either use all of them or decide what to do with each one.
The selection can filter based on node entry information such as node entry name (
@node), type (
@type), and derived type (
This can be concatenated in the usual way with other parameter selections.
The Assign Material ROP creates an HDA that wraps the Set Parameter ROP for material assignment. This can be used to change the surface, displacement or volume shader on a selection or to override shaders in an alembic procedural for example. The Assign Material ROP does the following:
- Points to an Arnold VOP network with the material definition.
- Finds the OUT_material.
- Finds the connected surface, displacement and volume shaders.
- Provides operator expressions for surface, displacement, and volume assignments automatically.
- Translates the shaders in the Arnold shader network.
The shader network (left) can be assigned with the Assign Material ROP using a single Set Parameter ROP (right).
Internally it uses a set_parameter node and it will fill out the set_parameter assignment fields
Final result. Scene file here.