RayType 1.1 Mental Ray shader


The RayType Mental Ray shader can assign different shaders (materials, textures, colors) to different kind of raytrace calculations. The node works like the mix of condition and switch nodes in Maya, to separate the following raytrace calls:

- eye
- reflection
- refraction and transparency
- light
- shadow
- environment
- finalgather
- photon
- custom
(Custom type can be choosed from the list of all available ray-types of mental ray: 41 for version 3.3)



By default the shader connected to the eye ray is called for very shading calculation but when you enable the checkbox of a specific ray type you override that calculation with the connected shader.
If nothing is connected than the black color is used that essentially negates most effects.

The "Continue Ray When Color Is Black" attribute makes the ray continue its path when the override color is black: it makes an object totally invisible for only a specific ray type. For example it allows removing objects from raytrace reflections without cancelling the ray, while the object still appears for final gathering. (If you'd like to continue a ray for an override but use the black color for another one with the same RayType node, assign very low values (for example 0.0001) instead of black to disable continuing the ray and still output black.)

A few examples how the shader can be useful:

- When using a background environment you can connect a texture to the eye rays and a blurred version of the texture to the finalgather rays to have nice, smooth FG and sharp reflections at the same time.

- Connect a simple lambert or even constant colored version of your complex shader to the reflection or refraction rays, to have much simpler and faster raytrace calculations. (When using glossy reflections most of the detail is blurred anyway. :))

- You can implement very subtle changes in reflections, refractions, FG without changing the reflected shader itself.

- Create an object that emits light using final gather but does not appear in reflections.

- Make an object invisible for a specific ray type.






- Copy DSO file into "alias/maya/mentalray/lib" (DLL for Windows / SO for linux and OSX)
- Copy MI file into "alias/maya/mentalray/include"
- Copy the Icon file into a standard maya icon directory.
- Copy the MEL file into a standard maya mel script directory.

- Modify "alias/maya/mentalray/maya.rayrc" with the two following lines, both of them comes after the
standard link and mi lines:

link "{MAYABASE}/lib/RayType.{DSO}"
mi "{MAYABASE}/include/RayType.mi"




RayType appears in the HyperShade at the `Create mental ray Nodes/Miscellaneous` tab.

- Maya 5 sample scenes are included to demonstrate altering reflection, transparency and finalgather rays and a Maya 6 scene shows the effect of "Continue Ray When Color Is Black". This attribute is not available for Maya 5 because it requires a Mental Ray 3.3 feature.

Advices, comments, bug-fixes and great new ideas are welcome.
The shader has been tested, but use it at your own risk, as always.