In the design of Mental Ray for Maya it was an important concept to integrate
it into the existing Maya architecture and logic as smoothly as possible.
The result of this is that the menus, options and settings of Mental Ray
are scattered in Maya: they can usually be found in the context of similar
Maya settings. In these writings I'd like to collect the places and functions
where Mental Ray appears. The first part deals with shaders.

When dealing with Mental Ray shaders are an essential concept. These
are not just materials (we have to avoid this common technical confusion),
they simply define the behaviour they are attached to. You find shaders
in many places of the rendering pipeline and by using them we can affect
the renderings in ways that are not possible using the Maya renderer.

There are many kinds of Mental Ray shader types and all of them has to
be used in a specific context. Shaders can be connected, modified, animated
the same way as any Maya node. Sadly none of the standard Mental Ray shaders
have well designed user interface, only the short attribute names are
displayed and not even default values are set. I find this pretty awkward
so you can download some custom user interface scripts from this site
to overcome these nuisances.

Shading Group

Shaders that are related to the look of materials can
be found on the Shading Group of the material. A new pulldown menu appears
on every shading group (at least after Mental Ray for Maya is started).
The easiest way of finding this is to select a material, open the attribute
editor and click on the small triangle on the top that points to the right.
This way the Shading Group is displayed in the window and a new menu entitled
Mental Ray appears.

This menu and the Mental Ray related attributes are only
created when you actually open the Shading Group in the AE. So you can
only make connections using the Connection Editor after you opened the
SG at least once. This can cause some problems when writing scripts because
sometimes you have to connect attributes that does not exist yet. In this
case you should use the miCreateMaterialAttributes name_of_the_ShadingGroup;
MEL command to create the needed attributes before connecting, without
opening the AE.

You find here all the shader types (there are plenty of
them) that define the look of a material. If there is anything connected
to one of these channels than that shader automatically replaces the Maya
shader when Mental Ray is rendering. The shaders are only responsible
for the channel you connect them to, so you can easily connect a single
photon shader to a standard Maya material. This way you override only
the way the material reacts to photon calculations.

The Mental Ray material shaders (and some other shader types)
deal with light in a particular manner: they don't care about Maya's light
linking mechanism and every light that effects a shader has to be explicitly
connected to that shader. This can be done by connecting the message attribute
of the light's shape node to the shader's lights attribute. (Precisely
into one of the elements of the lights array: Lights[0] or Lights[1]...)
This is an annoying procedure that is greatly simplified by the UI scripts
I was referring to earlier.
Beside the connection making some shaders' mode parameter affects lights
too: when mode is set to 1 it means that only the connected lights illuminate
the object. Mode 2 is the opposite: only unconnected lights illuminate
it. So if you'd like to have a shader illuminated by each and every visible
light of the scene you can easily set the mode attribute to 2 and forget
about connections. (This is the only way to get Maya's default light feature
to work.)
But this solution does not work with all shaders, for example the physically
plausible material shaders (like dgs_material) don't have a mode parameter.

Suppress all Maya shaders

By turning this switch on you ask maya not to use the
Maya material for any calculation when rendering with MR. This can be
useful if you don't need a surface material just a volume shader. This
way you don't have to connect anything the the MR Material Shader to disable
the maya material.

Opaque

If you turn this on MR treats the material as fully opaque
and does not do any transparency calculations. This can speed up the shading
process a bit, but it only works when the material is really non-transparent.

Material Shader - This is probably the
most often used shader: basically the material and color of the surface.
You should connect here shaders that define shading models. (For example
mib_illum_cooktor, mib_illum_ward…) Mental Ray's default material
shaders consist of the basic shading models (lambert, phong, blinn, cook-torrence,
ward) and some physically plausible materials (DGS_material, Dielectric_material).

Shadow Shader - This shader defines
how a material's cast shadow looks like. For effects like the shadow color
attribute in Maya you'd use a shadow shader in Mental Ray (per-material).
The only custom shadow shader in MR is mib_shadow_transparency, that computes
transparent shadows for transparent materials. (You don't really need
it when using Maya materials.)

Volume Shader (Volumetric Materials)
- Volume shaders define what happens inside the volume of the material.
This is similar to Maya's volumetric material. If you'd like to create
some kind of fog or volumetric light effect inside an object, than the
volume shader is the way to go. (mib_volume, parti_volume)

Photon Shader (Photonic Materials) -
In every calculation that involves photons (global illumination, caustics)
this shader defines how the material affects the photons, how it reflects,
absorbs, scatters the photons and what colors it uses. This can be useful
because you can modify global illumination effects without changing the
actual look of your material shaders. Some MR shaders have their own photon
version (pl. DGS_material_photon, dielectric_material_photon), that you
can connect to this channel when you use indirect illumination effects.
If the photon materials parameters are not defined (their values are 0)
than automatically the material shader's values are used.
Most material shaders work as photon shaders too so you don't have to
explicitly connect them to the photon shader channel too. The physically
plausible photon shaders are useful because they can be used to create
realistic light effects while still using standard shading models.

Photon Volumetric Shader - Affects how
photons behave right inside a material. (scattering / absorption.) Very
similar to photon shader.

Displacement Shader - This is basically
like Maya's displacement.

Environment Shader - If a ray cast by
the material shader (for example for computing reflection) does not hit
any objects in the scene, or there is no raytrace calculation at all,
or there is raytracing but the raytrace limit is reached than this shader
is called to define what should it display (instead of black). So if you
connect an image here the shader will display it in the reflection and
refraction.

Light Map Shader - This shader bakes
light calculations into file textures. Since maya has the detailed Convert
to File Texture mechanism, this shader is rarely used manually. But it
is there for completeness` sake, and for hardcore Mental Ray users.

Contour Shader - It is used to render
cartoon like contours and lines over the object. These shaders define
how to display the contours (standard / varying line width, colour, texture,
randomness) based on the information that is stored while rendering. To
render contours you have to use some other shaders in conjunction. More
about this topic later.

Camera

When selecting a camera you see that there is a Mental Ray menu here
too. Four different shader types can be connected here:

Output Shader - The output shaders make
calculations after the sampling of the image is finished. (Like Maya's
2d motion blur, depth of field or Paint Effects) Although similar modifications
can be done using a 2d composite software after the rendering, there is
much information at this state that is not available in the final rendered
image. (For example motion vectors, contours, normal vectors, pixel coverage)
You can explicitly set what kind of information to pass on to the output
shader, in the Framebuffer parameters.
The standard Mental Ray output shaders are just for displaying contour
lines. (contour_composite, contour_only, contour_ps)

Volume Shader - This is similar to the
material's volume shader, but it effects the whole scene and not just
one object. So if you'd like to render a fog that fills the entire scene
this is the way to go.

Lens Shader - Lens shaders define how
and where to shoot rays from the camera. They are mostly used for lens
distortion effects and correct depth of field calculations. (Lens shader
calculations work automatically in raytrace mode because they modify the
eye ray direction.)
By default only the physical_lens_dof end oversampling_lens are present:
physical_lens_dof calculates depth of field, and oversampling_lens oversamples
every rendered pixel by a number of rays.

Environment Shader - Similar to a material's
environment shader, but it effects every material in the scene that has
no environment shader of its own. Using this you can quickly set an environment
that every material „sees”.

The current version of Mental Ray for Maya (in contrast
with the standalone Mental Ray) only uses one lens and output shader.
In the future this will probably change.
The MEL command that creates the camera attributes without opening the
AE is:
miCreateOutputAttributes name_of_the_camera_shape;

Light

Light Shader - You can connect different light types
here and they override the behaviour of this light. Only the position
and the direction of the light is used, every other parameter mustbe set
on the light shader node.

Photon Emitter - This shader affects
how a light emits photons for global illumination calculations. This is
a very specialized effect and Mental Ray does not even have any custom
Photon Emitter shaders beside the default ones that are used by the standard
light types.

The MEL command that creates the camera attributes without
opening the AE is:
miCreateLightExportAttributes name_of_the_light_shape;

Geometry

Geometry shaders can be connected to maya transform nodes.
They copy or create a different object in the place of the original one.
This way you can swap a simple animatable model with a highly detailed
one for rendering or create insane amount of procedural geometry without
polluting the scene you work with.

At the moment Geometry Shaders can be rendered only with
Mental Ray shaders (by default they inherit the object's material you
connect them to). The standard geometry shaders are basic primitives (cone,
box, cylinder, sphere, plane, torus) and two shaders that creates instance
copies of previously exported mi geometry files. (mib_geo_instance, mib_geo_instance_mlist)
As far as I know these two are pretty unusable right now through the current
Maya user interface.

Contours

Contour shaders can be used in the Render Globals/Contours
menu. Because of some obscured reason these shaders have no specified
shader type, they are not separated to a specific tab so you have to rummage
among the Miscellaneous tab to find them.

Contrast Shader - This shader type defines
what kind of geometrical features should Mental Ray interpret as contours.
The contour_contrast_function_simple is a very simple process and it only
deals with outlines. Contour_contrast_function_levels is more robust and
it even has some parameters to tune.

Store Shader - Store shaders do nothing
else but store the lines defined by the contour_contrast shader. The contour_store_function_simple
deals with outlines only so basically you use the two simple versions
together. The contour_store_function is the one that works for everything
else.

And although it has no parameters the UI still has an ugly bug: when you
create the shader through the Render Globals window it does not connect
it by default (as for example the contrast works). You have to manually
connect it using the connection editor or MEL scripting to get it working.
So connect the contour_store_function's normalGeom output to the miDefaultOptions
contourStore input channel.

If you close the connection editor by mistake the easiest
way of finding the miDefaultOptions node, is turning off the Show DAG
Object Only flag in the outliner, select the node, and press the Reload
Right button in the Connection Editor. Or use this mel command after you
created the store shader:
connectAttr -force contour_store_function1.normal_geom miDefaultOptions.contourStore;