MayaMan Help Contents

# MayaMan Extra Pass

Some RenderMan tricks require that multiple passes be created, this dialog makes it easy to setup such passes.

### Output Extra Pass during Preview

This option controls whether the extra pass images are produced when doing a preview.

### Output Extra Pass during Render

This option controls whether the extra pass images are produced when doing a render-single or render-sequence.

### Skip Main Pass

If this option is turned on and there are extra passes that are enabled then the main pass will not be computed.

### Scripts Change Visibility

If the pass scripts changes layer/object visibility then you'll need to turn on this flag.. normally MayaMan discards hidden objects early but if they are going to be needed for later passes then this flag disables the culling.

### Create Passes From RenderLayers

Creates a MayaMan Extra Pass for each maya renderLayer, not overly clever but a starting point. Users may wish to then substitute their own script function that is based on the MayaManSelectRenderLayer one that is found in MayaManHelpers.mel. Each pass will only contain objects from that one layer. Layers with the MayaManMatte flag turned on will also be included but be matted.

### Create Passes From Selected ObjectSets

Creates a MayaMan Extra Pass for each selected objectSet. Users may wish to then substitute their own script function that is based on the MayaManSelectObjectSet one that is found in MayaManHelpers.mel. Each pass will only contain objects from that one layer. If 'MatteUnSelected' is turned on then each pass will also include the objects from other sets but as matte objects

### Variable expansion

In addition to the regular variables that mayaman will expand during translation there is also a PASS variable that will give the name of the pass being processed.

### Pass Options

Name | the name of the pass, used to generate rib and image names, also passed as the Attribute/user/passtype value
On | is the pass enabled?
Camera | the name of the camera to render. Note the name can be the parent of the camera (ie: persp instead of perspShape)
Script | the name of a mel function to run at the beginning/end of the pass, the script is called with an integer argument of 3 before a preview, 1 before a render, 2 after a preview and 0 after a render. Typically the only difference between preview and render will visibility manipulation of display .vs. render layers. MayaMan will automatically restore most parameters so the '0' invokation only has to undo tricky stuff. Note, you must not create or destroy things, you can manipulate visibility.
Shell | the name of a shell script function to run at the end of the pass, useful to convert the output of the pass (for example, a point cloud) into something required for the next pass.

### Example of Pass Config Script

        global proc my_passSetup(int $mode)
        {
          // create some attributes somewhere to hold the values I'm going to change
          // might as well hang them on the nugget
          if(!`objExists MayaManNugget.my_pass_old_width`) {
            addAttr -ln my_pass_old_width  -at long MayaManNugget;
            addAttr -ln my_pass_old_height -at long MayaManNugget;
          }

          switch($mode) {
          case 3:    // configure the scene for a preview
          case 1:    // configure the scene for a render
            setAttr MayaManNugget.my_pass_old_width  `getAttr defaultResolution.width`;
            setAttr MayaManNugget.my_pass_old_height `getAttr defaultResolution.height`;
            setAttr defaultResolution.width  512;
            setAttr defaultResolution.height 512;
            setAttr -type "string" MayaManNugget.CustomDisplay "framebuffer";
            if($mode == 3) {
              setAttr "ball_layer.visibility" 0;
              setAttr "small_layer.visibility" 1;
            }
            break;
          case 2:    // put settings back how they were before the preview
          case 0:    // put settings back how they were before the render
            setAttr defaultResolution.width  `getAttr MayaManNugget.my_pass_old_width`;
            setAttr defaultResolution.height `getAttr MayaManNugget.my_pass_old_height`;
            if($mode == 2) {
              setAttr "ball_layer.visibility" 1;
              setAttr "small_layer.visibility" 0;
            }
            break;
          }
        }

### Example of Pass Config Script With Extra Arguments

Sometimes it's useful to use one script to configure more than one pass... in this case the procedure should be declared with the $mode argument last.

    	global proc multi_pass_setup(string $mtl, string $chan, int $mode)
    	{
    		...
    	}

And the entry in the 'Script' field of the pass would be something like:

    	multi_pass_setup "lambert1" "diffuse"

### Selection And CropToSelected

One handy use for extra passes is to iterate through some models and just render the part of the image that contains each. This can be achieved by setting MayaManNugget.CropToSelected to 1 during the setup phase of the pass script.and selecting the desired models.

There is no need to restore the selection or set the CropToSelected flag back, mayaman will do that automatically.

Here is an example of a general purpose crop-to-selection pass script that also demonstrates the use of scripts with extra arguments.

    	global proc cropped_pass(string $which, int $mode)
    	{
    		switch($mode) {
    		case 3:    // configure the scene for a preview
    		case 1:    // configure the scene for a render
    			setAttr MayaManNugget.CropToSelected 1;
    			setAttr MayaManNugget.MatteUnSelected 1;
    			select $which;
    			break;
    		}
    	}

So the usage in the extra passes dialog would be along the lines of:

    	cropped_pass "somethingselectable"

### Create Passes From Render Layers

For Maya 7.0 and later only.... pressing this button will add an extra pass for each renderLayer in the scene, this may or may not be useful and is provided as an experiment.

MayaMan Help Contents