Maya itself has only a rudimentary level of support for creating render passes. Maya provides you with render layers (where you can specify sets of objects to be rendered separately) and also some predefined render passes (beauty, colour, shadow, diffuse and specular).
This plugin goes much further, allowing you to override literally any aspect of your scene depending on which pass you are currently rendering. For example, you can assign specific shaders for each pass, enable/disable lights and shadows, modify object visibility (including primary/secondary rays) and customise render globals settings for each render (e.g. turning on and off raytracing).
Because Render Passes for Maya makes real changes to your scene (as opposed to relying on support for passes in the renderer), it should be fully compatible with any rendering, export or pipiline system you have. For example you could have a single scene for rendering out some passes using the Maya renderer, some using RenderMan, and some for exporting to another tool in your production pipeline.
Alternatively, you can copy the RenderPass plugin into one of your existing MAYA_PLUG_IN_PATH locations, and copy the MEL files from the package to a directory somewhere within your MAYA_SCRIPT_PATH locations. You should also copy the HTML and PNG files to one of your MAYA_SCRIPT_PATH locations so you can access the online help from within Maya.
After updating your paths or copying the files, reload Maya and open the plugin manager. The RenderPass plugin should now be listed and you can load it (you can also set it to be automatically loaded whenever you start Maya). There may be multiple versions listed - if so select the one which looks like it matches your operating system and Maya version (Maya won't let you load the wrong one though).
For more help on installing custom plugins, please review the Maya documentation. If you're still stuck see the Support section at the bottom of this page.
![]() |
The first entry in this menu brings up the new Render Pass Editor, from which you can
define your passes and overrides. The Set Render Pass item brings up a sub-menu
listing all your current passes, allowing you to easily apply any one of them to the current
scene (you can tear-off this menu to float over your workspace). The menu item labelled
Create Render Pass Scenes brings up a window which allows you to optionally save out
a render scene for each one of your passes.
Finally, the Render Pass Help menu item brings up this online help from within Maya (NOTE: this will only work if you can normally launch Maya's own online help from within the program - sometimes under Linux this requires a browser window to be open on your desktop beforehand). For a quick run through using the plugin, you can read this simple tutorial. |
Using the Render Pass Editor you can create render passes and specify commands to be executed when you apply that render pass to your scene.
After creating some passes and giving them recognizable names, you then add your overrides and assign these overrides to the passes they should be applied to. An override consists of a name (so you can easily recognize it later) and two chunks of MEL code. The first section of MEL code is executed when a render pass containing that override is applied, and the second section of MEL code is executed when the effects are to be removed (i.e. when switching to another pass, or to have no pass applied).
In the simplest case you can just have one override for each of your passes - for example a render pass named ShadowPass and an override named ShadowOverride.
However, with a complex scene you might find yourself duplicating a lot of code amongst your overrides to do common things, such as turning on raytracing calculations. Instead, you could have an override named 'turnOnRaytracing' which activates raytracing in your render globals, and you have this override active in your 'beauty' and 'reflection' passes, and off in your 'mattes', 'depth' and 'diffuse' passes (for example).
As a general rule, it is best to keep each override to performing a single simple task, and have them on or off for different passes.
setAttr "lambert1.color" -type double3 1 0 0;
You can see that it is setting three values for the color attibute of the material lambert1 which would make it pure red in this case. Set the colour back how you want it and you will see the code that reverts that change again, e.g:
setAttr "lambert1.color" -type double3 0.5 0.5 0.5;
Many changes aren't shown in the script editor by default, and if you are trying to work out how a certain change is made you can turn on the Echo All Commands option in the script menu of the script editor. This will cause many more commands to be shown as they are executed in Maya. This will cause a lot more output, and you will have to do a bit of searching through to find just the minimal bit of code that will affect the change you're after.
I've also find that a great way to determine how to do something is to look in Maya's own MEL scripts to see how it does things. This can be a little tricky, but using a search program to look for little bits of text (such as the label of a menu that performs the function) recursively in Maya's scripts directories you can usually find what you're after.
If you are still stuck, you should find someone who does know MEL coding to help you out. The Maya forums on the excellent HighEnd3D site are also a great source of help. You shouldn't really be asking any questions specific to using this plugin on the Maya lists though - see the Support section at the end of this page for that.
You should also find a demo scene included in the package you downloaded (with versions for Maya4.0 and Maya4.5). This scene contains a number of pre-configured render passes. Just open the render view, and select each pass in turn and render it to see the results. You can then inspect the override code in the Render Passes Editor to see how it works.
Task | Override Code | Code to Revert |
Assign a Shading Group* | source "buildShaderMenus.mel"; assignSG specialMaterial_SG myObject; |
source "buildShaderMenus.mel"; assignSG normalMaterial_SG myObject; |
Hide an Object | setAttr myObject.visibility 0; | setAttr myObject.visibility 1; |
Turn on Raytracing | setAttr defaultRenderQuality.enableRaytracing true; | setAttr defaultRenderQuality.enableRaytracing false; |
Set Reflection Trace Limit | setAttr defaultRenderQuality.reflections 4; | setAttr defaultRenderQuality.reflections 0; |
Set Refraction Trace Limit | setAttr defaultRenderQuality.refractions 2; | setAttr defaultRenderQuality.refractions 0; |
Set Shadow Trace Limit | setAttr defaultRenderQuality.shadows 6; | setAttr defaultRenderQuality.shadows 0; |
Turn off an object's primary visibility |
setAttr myObject.primaryVisibility 0; | setAttr myObject.primaryVisibility 1; |
*Notes on the 'assignSG' command
This command is part of Maya, but for some reason they chose not to make it accessible until after the buildShaderMenus.mel script has been sourced. This normally happens when you right-click on an object. When using the assignSG command in an override, you should source this script yourself (as shown in the above example) to ensure it is available. This command prints out a line like // Result: big_ball_matSG // to the script editor - if you get tired of lots of these appearing when you switch between passes containing assignSG commands, you can comment out the line that prints this message in the buildShaderMenus.mel MEL script within your Maya installation.
Using the settings shown in the image above, the following files will be written out:
CURRENT_MAYA_PROJECT/renderScenes/myScene_mattePass.mb
CURRENT_MAYA_PROJECT/renderScenes/myScene_gradientPass.mb
CURRENT_MAYA_PROJECT/renderScenes/myScene_reflectionPass.mb
Where CURRENT_MAYA_PROJECT is your currently active maya project. The output directory should be an existing directory within your current project - usually 'scenes' or 'renderScenes' unless you have created another one yourself.
The only reason why you would need to use the Create Render Pass Scenes function is if you wish to render all your passes together on a render farm. If you only need to render one thing at a time, you can stick with your original scene file - just apply a render pass, render, set another pass, render, etc. If you apply a pass to your scene and save it, then it will remain setup for that pass if you perform a batch render using that scene file too.
addRenderPass [-edit INDEX] -name PASSNAME
This allows you to add new render passes. Any new passes will have no effect
until you assign overrides to be associated with that pass. Passing the -edit flag
with a pass index (zero based) allows you to edit the name of an existing pass.
addRenderPassOverride [-edit INDEX] -name [-pass PASSNAME | -nopasses] -overrideCode CODESTRING
-defaultCode CODESTRING
Allows you to add new overrides, and also to edit them (including assigning them
to one or more passes). The -pass flag can be used any number of times to assign
an override to multiple passes. The -nopasses flag is used to remove all pass assignments for this override when in editing mode.
deleteRenderPass -pass PASSINDEX | -override OVERRIDEINDEX
Use this command with either the -pass or -override flags to delete an existing
pass or override. Deleting a pass will automatically remove all references to it
in any overrides assigned to it (but will not delete the overrides themselves).
renderPassInfo -numPasses | -numOverrides | -currentPass | -passName
PASSINDEX | -overrideName OVERRIDEINDEX | -overridePasses OVERRIDEINDEX |
-overrideCode OVERRIDEINDEX | -defaultCode OVERRIDEINDEX
Use this command to query any information about the render passes you have
defined. Use the zero based index when asking about a particular pass or
override. The command returns data in different formats depending on what is
being asked: int for -numPasses/-numOverrides, string for
-currentPass/-passName/-overrideName/-overrideCode/-defaultCode, and a
string array for -overridePasses.
applyRenderPass PASSNAME
This applies an existing render pass to the current scene. The revert code for
all existing passes will be executed, followed by the override MEL code for the
specified pass.
You can download the latest release of the plugin at http://www.technolumiere.com/