mental ray for Maya custom shaders
 
 
 

Custom shaders

Custom shaders are custom-coded mental ray shaders that let you create looks over and above those that can be achieved with the standard mental ray for Maya Base shaders. You (or third-party developers) can create them in C or C++ language, then process them into modes that you can see and use in Maya.

A collection of custom shaders (one or more) make up a Custom Shader Library. Custom shaders are typically distributed in custom shader libraries. To see a particular custom shader in Maya, you must load the shader library that contains that custom shader. See Load shaders.

Custom mental ray shaders with color attributes create corresponding RGBA attributes in Maya. This means that the alpha_component of color values on custom shaders can drive or can be driven by Maya shading networks.

Custom shaders written for Maya’s Software renderer can be related to mental ray for Maya custom shaders. The correspondence is driven by an .mi declaration that is loaded in the Shader Manager. Then, mental ray for Maya detects the corresponding Maya shading node. The corresponding parameters (attributes), and connections to other supported nodes (Maya or custom nodes) are associated. As a result, you can create a single shading network that is compatible for both Maya and mental ray rendering. See Relate Maya custom shaders to mental ray for Maya custom shaders.

Custom shader libraries

Custom shaders are distributed in custom shader libraries. To see a particular custom shader in Maya, you must load the shader library that contains that custom shader.

A custom shader library consists of two files:

  • a declaration file (for example, mayabase.mi) that contains descriptions of the interfaces of the shaders
  • a library file (for example mayabase.so or mayabase.dll) that contains the actual implementations of the shaders

The Node Factory (see The Node Factory) creates the Maya-type nodes from your custom shader declarations. These nodes work just like regular Maya nodes: you can use them to build shading networks; you can save, load, and export them; you can write your own Attribute Editor templates; and you can provide icons, swatches, and help files. See the devkit for more information and examples.