MayaMan Help Contents

# MayaMan Batch Command

MayaMan comes with a command line batch utility, so that you can create and render RIB files without needing to open the Maya interface. This page outlines the many arguments you can pass to this utility to modify MayaMan's behaviour, without having to save those changes into your scene.

You can find the utility in the MAYAMANROOT/bin directory of your installation.

### Overview

The MayaMan Batch command can be used to launch MayaMan renders without opening the Maya graphical interface. This is most useful for executing renders from scripts or render farm systems.

When using MayaMan Batch, you tell it the name of an existing Maya scene file. All the MayaMan settings will be used from the scene file, unless you override the settings using command line arguments to the batch command. These arguments are detailed below.

NOTES

MayaMan Batch relies on having the Maya libraries (e.g OpenMaya.dll) in the current path. The version of the MayaMan Batch command should match the version of the Maya libraries in your path. i.e. use 'mayaman_batch_m5.exe' if Maya 5 is in your path, and 'mayaman_batch_m6.exe' if using Maya 6.

If the translation fails with a popup that says "Unable to determine the Maya environment" or that the "MAYA_LOCATION" environment variable is not set then you'll need to first set MAYA_LOCATION before launching mayaman batch, ie:

            set MAYA_LOCATION=c:\program files\aw\maya6.0

A common problem is that per-particle expressions do not evaluate in batch mode... this appears to be a problem with Maya in MLibrary mode. To work around this ribs should be created from mayabatch like this:

            mayabatch -batch -proj d:/my/project -script do_ribgen.mel

Where do_ribgen.mel looks like this:

            file -o -f "d:/my/project/scenes/the_scene.ma";

                          source "MayaManHelpers.mel";

                          setAttr MayaManNugget.DeleteRib 0;
                          setAttr MayaManNugget.CompressRib 0;
                          setAttr MayaManNugget.BinaryRib 0;
                          setAttr MayaManNugget.ShowProgress 1;
                          setAttr MayaManNugget.OutputInfo 3;
                          setAttr MayaManNugget.ZeroPadFilenames 1;

                          setAttr defaultRenderGlobals.extensionPadding 4;

                          setAttr -type "string" MayaManNugget.RibDir         "d:/ribs/the_scene";
                          setAttr -type "string" MayaManNugget.ImageOutputDir "d:/images/the_scene";

                          setAttr MayaManNugget.GenerateRibOnly 1;

                          setAttr defaultRenderGlobals.animation 1;
                          setAttr defaultRenderGlobals.startFrame 1;
                          setAttr defaultRenderGlobals.endFrame 200;

                          MayaManRender -commandline;

### Command Line Arguments

    USAGE: mayaman
           [-projectdir ]
           [-ribonly][-render]
           [-ribdir ]
           [-imagedir ]
           [-ribbase ]
           [-resolution  ]
           [-crop    ]
           [-ses   ]
           [-referenceframe ]
           [-cam ]
           [-pixelsamples  ]
           [-spatialquality  ]
           [-temporalquality ]
           [-srate ]
           [-blur   ]
           [-blursegs ]
           [-display ]
           [-shadows]|[-noshadows]
           [-shadowsonly]
           [-refl]|[-norefl]
           [-ribstyle flat|flatqual|objinst|archive|delayed]
           [-del]|[-nodel]
           [-alfred]|[-noalfred]
           [-binaryrib]|[-asciirib]
           [-skinny]|[-fat]
           [-compress]|[-nocompress]
           [-server]
           [-skipIfRendered]
           [-selected|-all|-object |-layer ]
           [-dolayer ]
           [-eochans][-noeochans]
           [-numcpus ]
           [-numrenders ]
           [-setattr  ]
           [-setstringattr  ]
           [-archive [-nomtl +shadowrib +tree -nobasexform]]
           [-us]
           [+unix|-unix]
           [+verbose|-verbose]
           [-script foo.mel]
           [-preloadscript foo.mel]

-projectdir <projectdir>
This option sets the project directory.

-ribonly
When this option is specified MayaMan will only create the ribs, the renders will not be invoked. This is the opposite of the -render flag.

-render
When this option is specified MayaMan will create the ribs and the renders will be invoked. This is the opposite of the -ribonly flag.

-ribdir <directory>
Using this option you can override the directory into which MayaMan will write the RIB and other files it produces.

-imagedir <imageoutputdirectory>
Using this option you can override the directory into which MayaMan will write the images it renders.

-ribbase <basename>
Allows you to specify the base name of the RIB files MayaMan creates. e.g. '-ribbase foo' will result in RIB files like 'foo.1.rib'

-resolution <hres> <vres>
Sets the resolution of the rendered frames

-crop <xmin> <xmax> <ymin> <ymax>
Specifies the region of the output frame that will be rendered. The coordinates are x=0, y=0 in the top left corner, and x=1, y=1 in the bottom right corner.

Note, unless cropping is requested on the command line then no-cropping is assumed regardless of what was saved in the scene file.

-ses <start> <end> <step>
Specify start/end/step frame values for rendering. See also -referenceframe.

-referenceframe <frame>
Specify the frame number at which constant geometry and constant shadow maps are created. Note, does not have to be in the range specified by -ses. Using a value outside the range is useful when distributing ribgen/rendering as you can ensure that only one machine will attempt to create these files.

-cam <camera>
Use this to specify the name of a camera to use when rendering. Specify the name of the camera shape node (e.g. cameraShape1 rather than camera1). See the MayaMan F.A.Q. for further discussion about how MayaMan chooses between multiple cameras by default.

-pixelsamples <x_samples> <y_samples>
Here you can override the RenderMan pixel sample values used by MayaMan.

-spatialquality <x_samples> <y_samples>
Control for Entropy's alternative to pixelsamples. Also see -temporalquality.

-temporalquality <samples>
Control for Entropy's alternative to pixelsamples. Also see -spatialquality.

-pixelsamples <x_samples> <y_samples>
Here you can override the RenderMan pixel sample values used by MayaMan.

-srate <shadingrate>
Here you can override the RenderMan shading rate used by MayaMan.

-blur <camera> <vertex> <motion>
Specify the blur values for camera, vertex and motion. Setting the blur amount to zero turns the associated blurring off. See the MayaMan Motion Blur Options page for further explanation.

-blursegs <segments>
Sets the number of segments to use for MayaMan's multi-segment motion blur.

-display <driver>
You can specify the name of a RenderMan display driver to use when rendering. NOTE: MayaMan only allows the use of certain display drivers during previews. e.g. if you attempt to use 'framebuffer' when performing a command line render, MayaMan will automatically change the display driver to one that outputs an image file.

-shadows / -noshadows
Using these options you can enable or disable the rendering of shadow maps.

-shadowsonly
Only do shadows. Many multi-pass rendering solutions require production of special purpose shadow maps. Using this mode turns off all shadow deletion but does not ignore shadow reuse.

-refl / -norefl
Using these options you can enable or disable the rendering of reflection maps.

-ribstyle flat|flatqual|objinst|archive|delayed
MayaMan can output RIB files formatted in various ways, and this argument can control this behaviour. For more details see the MayaMan Advanced Options dialog.

-del / -nodel
This argument tells MayaMan whether it should delete the RIB files it creates after rendering them.

-binaryrib / -asciirib
Forces MayaMan to create ribs in either binary or ascii mode, binary is faster and takes less disk space which ascii is useful for debugging or further processing by other tools.

-skinny / -fat
Turn on/off skinny rib mode.

-compress / -nocompress
Turn on/off zip compression of ribs.

-alfred / -noalfred
Controls whether MayaMan should create and possibly auto-execute a script for Pixar's Alfred network rendering system. See also the -server option.

-server
Puts MayaMan into an alfred style 'persistent-app' mode which is useful for distributing generation of ribs. It is fully compatible with alfred and can be driven from a perl script like this:

``

    	#!/bin/perl

    	$file  = shift(@ARGV);
    	$proj  = shift(@ARGV);
    	$start = shift(@ARGV);
    	$end   = shift(@ARGV);
    	$step  = shift(@ARGV);

    	open(ALFRED, "> alfred.script");

    	print ALFRED "##AlfredToDo 3.0\n";
    	print ALFRED "Job -title { $file ";
    	open(PREAMBLE, "mayaman_batch_m5 $file -projectdir $proj -preamble |");
    	while(<PREAMBLE>) {
    	    print ALFRED;
    	}
    	close(PREAMBLE);
    	print ALFRED "} -subtasks {\n";
    	for( $num = $start; $num <= $end; $num += $step ) {
    		print ALFRED "Task {Frame $num} -cmds {\n";
    		print ALFRED "  Cmd { mayaman_batch_m5 $file -projectdir $proj -server -display file -ses $start $end $step -referenceframe $start } -msg {render $num} -tags {intensive} -expand 1\n";
    		print ALFRED "}\n";
    	}
    	print ALFRED "}\n";
    	close(ALFRED);

    	system("alfred alfred.script");
    	unlink("alfred.script");

Which, when invoked like this on Windows:

``

    	perl drive_mayaman_alfred.ph my_scene.mb c:\temp\my_project 1 100 1

or this on Linux/Irix:

``

    	drive_mayaman_alfred.ph my_scene.mb /home/users/me/maya/projects/my_project 1 100 1

Will create and passes to alfred a script with one task per frame. Alfred will launch one or more MayaMan instances that will remain in memory and create ribs as required. MayaMan only reponds to two commands, 'render ####' which will create the ribs and pass back to alfred script commands for frame #### and 'echo ' which is required to conform with the alfred protocol.

Note the use of -referenceframe to ensure that only the first instance of mayaman_batch gets assigned the task of creating constant shadow maps and geometry files.

Server mode responds to the 'echo' and 'render' commands. The render command can accept multiple frame numbers at one go.

-skipIfRendered
If the output file already exists then don't re-render that frame.

-selected/-all/-layer <name>/-object <name>/-dolayer <name>
Render only selected objects or all of them. It is up to the user to remember what they had selected when the scene was saved.

Note, -selected doesn't actually work as maya doesn't remember what was selected!

-layer and -object may be specified more than once but should not be mixed.

-object will work with wildcards just like a regular maya selection command.

Note, the '-layer' switch turns on/off the 'renderable' attribute on the layer, in Maya 7.0 and later the '-dolayer' switch which choose which layer will actually be processed. -dolayer can only be specifyied once.

-eochans/-noeochans
Enable/disable the extra output channels that have been requested in the Extra Output Channels dialog.

-numcpus <number>
Set the number of CPUs to use (Advanced Options)

-numrenders <number>
Set the number of renders to use (Advanced Options)

-setattr <attribute> <value>
This flag allows the user to edit any of the MayaMan Global (simple) Attributes.
An example would be `mayaman_batch_m4 x:\myScene -projectDir x:\myproject -setattr RibStyle 4`, which enables the use of Flat Ribs by executing the following MEL command: `setAttr MayaManNugget.RibStyle 4`.
To learn the names of the attributes, try editing the attribute using MayaMan's GUI, then have a look in the Script Editor which will show the entire command executed.

-setstringattr <attribute> <value>
This flag allows the user to edit any of the MayaMan Global (string) Attributes.
An example would be `mayaman_batch_m4 x:\myScene -projectdir x:\myProject -setstringattr CustomDisplay file`, which tells the renderer to use the "file" display driver by using the following MEL command: `setAttr -type "string" MayaManNugget.CustomDisplay file`.
To learn the names of the attributes, try editing the attribute using MayaMan's GUI, then have a look in the Script Editor which will show the entire command executed.

-archive
This flag allows creation of rib archives. The -ribdir, -ribbase and -ribstyle and -object options are very useful in this mode. In -archive mode you can also specify some sub-flags. -nomtl causes the resulting rib to have no materials. +shadowrib also creates a form of the rib for use in shadow passes. +tree when an -object is chosen this option will also cause the whole sub-hierarchy to be archived too. -nobasexform should the base transform of the model be included in the archive or not?.

eg: mayaman_batch race.mb -ses 1 100 1 -asciirib -ribstyle flat -object greencar -ribdir /tmp -ribbase greencar -archive +shadowrib +tree -nobasexform

-us
Source the 'userSetup.mel' file before the scene is loaded. The file is located by searching the MEL_SCRIPT_PATH.

+unix|-unix
Explicitly turn on/off unix rib mode... only has an actual effect if the render is not launched immediately otherwise the platform that the ribs are created on will dictate the rib style..

+verbose|-verbose
Explicitly turn on/off the verbose flag.

-script <mel>
Execute <mel> after the scene is loaded but before anything else happens... may be useful to use this more than once.

-preloadscript <mel>
Execute <mel> before the scene is loaded... useful to load plugins, ie: ``

    -preloadscript "loadPlugin \"myplugin.mll\""

... may be useful to use this more than once.

-sourcefile <mel file>
Apply 'source' to <mel file> after the scene is loaded but before anything else happens... may be useful to use this more than once.

-preloadfile <mel file>
Apply 'source' <mel file> before the scene is loaded... useful to load plugins, may be useful to use this more than once.

MayaMan Help Contents