Appendix A: Extra mental ray render settings
 
 
 

In addition to the render options in the Render Settings window, you can also set the following render settings using MEL commands.

Render Mode

You can set the render mode by using the following MEL command:

setAttr mentalrayGlobals.renderMode <value>;

Where value is as follows:

You may choose to render only shadow maps or final gather maps when the shadow and final gather information does not change throughout your scene.

For all renders after your final gather render, set Rebuild to Off or Freeze in the Render Settings: mental ray tabs, Indirect Lighting tab, Final Gathering section, Final Gathering Map sub-section.

For all renders after your shadow map render, set the Rebuild Mode to Reuse Existing Maps in the Render Settings: mental ray tabs in the Indirect Lighting tab, Shadows section, Shadow Maps sub-section.

Export Verbosity

You can set the verbosity level for messages from the translation process. Messages equal to or below the selected severity are displayed in the script editor.

Set the verbosity level using the following MEL command:

setAttr mentalrayGlobals.exportVerbosity <value>;

Where value is as follows:

Multiple custom state shaders

mental ray installs its own state shader to perform pre- and post-shading operations like sample conversion for rendering with Maya base shaders. Custom state shaders can be chained to perform additional operations.

To do so, follow these steps:

  1. Ensure that miDefaultOptions exists. Otherwise, open the Render Settings window or perform a render.
  2. stateShaderList is order sensitive. Append state shaders to the end as follows, where index is the size of the stateShaderList; or, reorder as needed.
    connectAttr "myStateShader.message" "miDefaultOptions.stateShaderList[index]";

The connected nodes are translated in addition and appended to the standard Maya base state shader (if not disabled) and the potential single state shader node connected to the original stateShader attribute.

Export includes startup file option

The Export includes startup file option has been removed from the File > Export All, Export Selection (mental ray) dialog box. To enable this option, use the following mel script:

optionVar -iv "mentalrayExportStartupFileOption" 1;

With this option enabled, the exported .mi file contains an $include directive for the maya.rayrc startup file that is used by the interactive mental ray renderer in Maya. Use this option to ensure that a consistent configuration is used for rendering both with the mental ray standalone and interactively in Maya.