The is a mental ray for Maya extension that allows you to turn any shading graph consisting of mental ray nodes into a mental
ray . This encapsulates the shading graph into a new single shading node with custom input and output parameters, and hides the internal
details from the user. are stored in regular .mi files, and can be loaded into Maya as regular shader nodes using the . See the mental ray reference guide for more details on .
Creating
The basis for building and attaching Maya shading graphs is the Maya utility node Mentalray , also referred to as node (Maya node type: mentalrayPhenomenon). It allows you to attach Maya shading graphs easily, and automatically generates the required input attributes on the node. It also provides access to all the advanced mental ray options. The full phenomenon description can be exported to a .mi file for later use.
All options are available in the of the node grouped under the tab. These include version number, apply flags, and requirements. For more information, see in the mental ray reference guide.
Workflow in Maya
To build your phenomenon in Maya
- Build the initial as follows:
- Create a node (In the , select ).
- Create a mental ray render node intended as the root. The output of this node determines the output attributes of the whole .
- Shift-drag the node onto the node. The opens with the two nodes selected.
- Connect the attribute of the node to the root attribute. You may need to select to see the message attribute.
Note
Upon connecting the root node of the , all additional output (read-only) attributes of that node are also dynamically added to the node as output. They are considered fields of the final output parameter struct of the .
- Build the shading graph content
- Create and connect new nodes to the root node as driving nodes.
- Set input attributes of those nodes to the desired constant values if they are not going to be exposed as interface parameters.
- Build the interface
Create input parameters for the from input attributes of any content node by drag-dropping the onto the desired node, and then connecting an interface array element to the desired attribute.
Note
- Upon connecting an interface element, the attribute behind that plug is dynamically copied to the , and can be connected to other nodes. Unlike the root attribute (there can only be one root), more than one connection may
originate from a single interface element. The checks if new connections are compatible with the existing dynamic attribute. If not, the connection is refused and an error
message is reported.
- When disconnecting interface elements or the root attribute, the corresponding dynamic attributes are also deleted.
To export the phenomenon to a .mi file
- Select the node in Maya.
- Select File > Export Selection >
- Set to
- Turn on
- Select the filters shaders, and .
- Click the button.
General Rules
- Mental ray phenomena are considered closed. Shaders inside phenomena must not connect directly to the outer shading graph.
Instead, they must pass through the interface.
- mental ray does not support connections to whole parameter struct but only to individual fields. Therefore, interface elements
can only be connected to atomic data types (boolean, integer, float, double, and so forth) and compounds with three numeric
children (vectors or colors). The mental ray tags are represented as message attributes. Any other type of connection is rejected.
Root nodes, however, can have any type of (even compound) result attributes.
- Use of the with the Phenomenizer is encouraged. The workflow is somewhat restricted. It does not allow you to connect interface elements to compound plugs and array elements.
Furthermore, dynamic attributes may not show up in the UI.
- Save your scene (or shading graph) regularly. The workflow introduces cyclic dependencies into the Maya dependency graph, with the potential to cause problems.
Limitation
- Attribute naming conflicts are not resolved automatically. When connecting a new interface element to an attribute, the name
of that attribute is used as the new name of the corresponding interface attribute. If such a name exists already in the interface,
the attribute creation fails. If necessary, rename the attributes in the interface before establishing new interface connections.