Edit the maya.rayrc file

A default maya.rayrc file is installed automatically with the mental ray for Maya plug-in. Each version of Maya has its associated maya.rayrc file, for example, one for Maya 2015 and one for Maya 2016.

Use this file to set mental ray registry entries. Editing the maya.rayrc file is optional.

Upon startup, it is directly read by the integrated mental ray bypassing Maya.

The file uses regular .mi syntax, and can be used to customize mental ray internal settings such as search paths. Custom shader packages that are directly loaded in this file are not recognized by Maya. Use the node factory mechanism instead to make your shaders visible as Maya nodes and get them automatically loaded into mental ray.

Editing the maya.rayrc requires you to restart Maya. Alternatively, you can type the following in theScript Editor (see Mayatomr MEL documentation for more details):

Mayatomr -updateRayrc

Global v local preferences

The maya.rayrc registry entries apply globally to all users on the same machine. Only an individual with administrative privileges can modify this file. However, you can create a local version of this file to suit your individual preferences.

To do so, copy the global file to your Maya prefs directory (see Save preferences for information on where to locate your preferences folder), and edit this local file as necessary. This local version of the file now takes precedence over the global version.

To check if this local file is loaded correctly, open the Maya Script Editor after loading the Mayatomr.mll plug-in, and check if this line exists:

// mental ray for Maya: loading startup file: C:/Users/yourName/Documents/maya/201x/prefs/maya.rayrc

Shader libraries

By default, mental ray for Maya looks for shader libraries in the mentalrayForMaya201x/shaders directory of your mental ray installation.

If certain shader packages need to be pre-loaded into mental ray for rendering, you may add them to the maya.rayrc.

Note:

The maya.rayrc file does not create custom nodes in Maya. Instead, it should be used in conjunction with the MI_CUSTOM_SHADER_PATH and MI_LIBRARY_PATH environment variables. See Load shaders.

To edit the maya.rayrc file

The following is an example of how to edit the maya.rayrc file.

Assuming the declaration file is myshader.mi and the shader file is myshader.dll/so, do the following:

	link "SHADER_FILE_DIRECTORY/myshader.{DSO}" 
	$include "MI_FILE_DIRECTORY/myshader.mi"

An example of maya.rayrc:

# define some useful registry variables
	registry "{MAYABASE}" 
	value "C:/Program Files/Autodesk/Maya201x/mentalray" 
	end registry
	registry "{SYSTEM}" value "windows" end registry
	registry "{DSO}" value "dll" end registry
# adjust mental ray library search path to look for
# shader binaries in my local directory first
	registry "{_MI_REG_LIBRARY}"
	value "C:/myshader/Release;{MAYABASE}/lib"
	end registry
# execute expensive commands upon rendering only
	registry "{_MI_MAYA_STARTUP}"
	value "mental ray startup upon first render"
# force some standard shaders into mental ray hidden to Maya
# (not using explicit directory path here when using network rendering)
	link “myshader.{DSO}”
# force the declaration of my shaders into mental ray, in case
# it was not loaded with mental ray for Maya Node Factory
	mi "C:/myshader/include/myshader.mi" 
	echo "mental ray for Maya - custom startup done"
	end registry
Note:

You can now specify the location of the maya.rayrc startup file with the new MAYA_MR_STARTUP_DIR Maya environment variable.

OpenEXR 2.0 multi-part output

mental ray for Maya supports multi-part and multi-layer output for OpenEXR 2.0. mental ray has the ability to write multiple layers into separate OpenEXR parts. The names of the OpenEXR parts match the names of the mental ray frame buffers.

Multi-part EXR files can improve file read performance in applications that support the reading of OpenEXR 2.0 multi-part files. However, if the application reading the file does not support this standard, then the file will not be backwards compatible.

This feature is not compatible with OpenEXR 1.7. Therefore, for backwards compatibility, mental ray for Maya sets the _MI_OPENEXR_MULTI_PART registry value to disable multi-part output by default. To enable multi-part output, remove this registry value from the maya.rayrc file.