Edit the maya.rayrc file
 
 
 

Editing the maya.rayrc file is optional.

NoteThe 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.

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.

By default, mental ray for Maya looks for shader libraries in the default install directory.

Windows:

...\Autodesk\Maya2010\mentalray

Mac OS X:

.../files/Applications/Autodesk/maya2010/Maya.app/Contents/mentalray

Linux:

.../files/usr/autodesk/maya2010/mentalray

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

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

Mayatomr -updateRayrc

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/Maya2010/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
NoteYou can now specify the location of the maya.rayrc startup file with the new MAYA_MR_STARTUP_DIR Maya environment variable.