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 .mi files, 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 .mi file 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 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.
NoteUpon connecting the root node
of the Phenomenizer, all additional output
(read-only) attributes of that node are also dynamically added to
the Phenomenizer node as output.
They are considered fields of the final output parameter struct
of the Phenomenon.
- 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.
Note
- Upon connecting an interface element,
the attribute behind that plug is dynamically copied to the Phenomenizer,
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 Phenomenizer 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 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.
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.