![]()
Appendix B: Phenomenizer
![]()
The following appendix describes how to create mental ray phenomena inside Maya.
The Phenomenizer is a mental ray for Maya extension that allows you to turn any shading graph consisting of mental ray nodes into a mental ray Phenomenon. This Phenomenon encapsulates the shading graph into a new single shading node with custom input and output parameters, and hides the internal details from the user. Phenomena are stored in regular
.mifiles, and can be loaded into Maya as regular shader nodes using the mental ray Shader Manager. See the mental ray reference guide for more details on Phenomena.Creating Phenomena
The basis for building and attaching Maya shading graphs is the Maya utility node Mentalray Phenomenon, also referred to as Phenomenizer node (Maya node type: mentalrayPhenomenon). It allows you to attach Maya shading graphs easily, and automatically generates the required input attributes on the Phenomenon node. It also provides access to all the advanced mental ray Phenomenon options. The full phenomenon description can be exported to a
.mifile for later use.Phenomenon Options
All Phenomenon options are available in the Attribute Editor of the node grouped under the Options tab. These include version number, apply flags, and requirements. For more information, see Phenomenon in the mental ray reference guide.
Workflow in Maya
To build your phenomenon in Maya
- Build the initial Phenomenon as follows:
- Create a Phenomenizer node (In the Hypershade, select Create mental ray nodes > Miscellaneous).
- Create a mental ray render node intended as the Phenomenon root. The output of this node determines the output attributes of the whole Phenomenon.
- Shift-drag the node onto the Phenomenizer node. The Connection Editor opens with the two nodes selected.
- Connect the message attribute of the node to the Phenomenizer root attribute. You may need to select Left/Right Display > Show Hidden to see the message attribute.
- 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 Phenomenon interface
Create input parameters for the Phenomenon from input attributes of any content node by drag-dropping the Phenomenizer onto the desired node, and then connecting an interface array element to the desired attribute.
To export the phenomenon to a .mi file
- Select the Phenomenon node in Maya.
- Select File > Export Selection >
- Set File type to mentalRay
- Turn on Export selected items only
- Select the filters Factory shaders, and Phenomenizers.
- Click the Export Selection 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 Phenomenon 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 Connection Editor with the Phenomenizer is encouraged. The Hypershade 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 Phenomenon workflow introduces cyclic dependencies into the Maya dependency graph, with the potential to cause problems.
Limitations
- Materials, lights, and instances inside phenomena are not currently supported.
- 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.