Creating A Maya .bat Render File //

Rendering straight out of Maya requires precious system resources that will bog down your computer if you plan on rendering complex scenes. Using a batch file doesn't even need Maya running, and it allows you to render multiple scenes at once. Here are the steps of creating a fcheck .bat file.

First, a dissection of a working file: (The scenes are in the same folder as the .bat file. If you would like the .bat file to find a remote scene in a different directory, you must include the full DOS path in 8.3 file name format).

Don't copy the pink stuff. Only copy the white stuff. Simply make a new text file called render.bat (or whateveryoulike.bat), and double click it to run after defining the scenes and tags.


// start of file



REM // This file renders 8 different scenes to be compiled
REM // into a quicktime VR. Each scene has 60 frames.


C:\Progra~1\Maya\bin\render -s 1 -e 60 -im top_1 top_1.mb
C:\Progra~1\Maya\bin\render -s 1 -e 60 -im top_2 top_2.mb
C:\Progra~1\Maya\bin\render -s 1 -e 60 -im top_3 top_3.mb
C:\Progra~1\Maya\bin\render -s 1 -e 60 -im top_4 top_4.mb
C:\Progra~1\Maya\bin\render -s 1 -e 60 -im top_5 top_5.mb
C:\Progra~1\Maya\bin\render -s 1 -e 60 -im top_6 top_6.mb
C:\Progra~1\Maya\bin\render -s 1 -e 60 -im top_7 top_7.mb
C:\Progra~1\Maya\bin\render -s 1 -e 60 -im top_8 top_8.mb


// end of file


Here's the breakdown:

REM
These are comments. Use REM when you want to organize the guts of your .bat files for lack of future confusion.

C:\Progra~1\Maya\bin\render
This is the full path of where Maya's render.exe is located. Find it, and then replace the directory names with their 8.3 character DOS versions. (Program Files = Progra~1).

-s 1
Start frame.

-e 60
End frame.

-im top_1
Output filename. Change this to something obvious. It will output to the current project directory in Maya.

top_1.mb
Scene file to be rendered. (It's in the same directory as the .bat file so I wouldn't have to list the full path).

All the other parameters of these scenes were defined in the Render Globals for each scene within Maya, like output image format, which camera to use, raytracing, etc etc. I didn't really even need to define the start and end frames in the .bat file, but I did anyway because I wanted to make sure everything would work. In Render Globals, I had a frame step of 2, so my animation's were only 30 frames in length. I also could have defined this in my .bat file, but I didn't just because I didn't feel like iit. In the command prompt, you can check out what flags are acceptable to use when calling the Render.exe by typing render /?, but I'll list them here anyway. Every scene you define in your .bat can have different variables, (not like my example where the only thing that changes is the scene name). Here's what will come up if you query the render command from within the command prompt:


// Render Flags

sage: Render <options> <filename>
where <filename> is a Maya ASCII or a Maya Binary file.

 

startFrame            -s   <float>     starting frame for an animation sequence

endFrame              -e   <float>     end frame for an animation sequence

byFrame               -b   <float>     by frame (or step)
                                       for an animation sequence

startExtension        -se  <int>       starting number for the output image
                                       frame file name extensions

byExtension           -be  <int>       by extension (or step) for the output
                                       image frame file name extension

extensionPadding      -pad <int>       number of digits in the output image
                                       frame file name extension

project               -proj <dir>      project directory to use

renderDirectory       -rd  <path>      directory in which to store image file

image                 -im  <filename>  image file output name (identical to -p)

pix                   -p   <filename>  image file output name (identical to -im)

mayaExtension         -me  <boolean>   append maya file name to image name
                                       if true

mayaFormat            -mf  <boolean>   append image file format to image name
                                       if true

cameraOverride        -cam <name>      all subsequent -im -p -ar -sa flags
                                       apply only to <camera_name>
                                       (specifying '-cam <camera_name>' enables
                                       rendering for that camera). If '-cam
                                       <camera_name>' is on the command line,
                                       then only the camera(s) specified on the
                                       command line will be rendered.

gamma                 -g   <float>     gamma value

ignoreFilmGate        -ifg <boolean>   use the film gate for rendering if false

imageHeight           -ih  <int>       height of image in pixels

imageWidth            -iw  <int>       width of image in pixels

deviceAspectRatio     -ard <float>     device aspect ratio for the rendered imag
e

aspectRatio           -ar  <float>     aspect ratio for the film aperture

maximumMemory         -mm  <int>       renderer maximum memory use
                                       (in Megabytes)

motionBlur            -mb  <boolean>   motion blur on/off

motionBlurByFrame     -mbf <float>     motion blur by frame

shutterAngle          -sa  <float>     shutter angle for motion blur (1-360)

motionBlur2D          -mb2d <boolean>  motion blur 2D on/off

blurLength            -bll <float>     2D motion blur blur length

blurSharpness         -bls <float>     2D motion blur blur sharpness

smoothValue           -smv <int>       2D motoin blur smooth value

smoothColor           -smc <boolean>   2D motion blur smooth color on/off

keepMotionVector      -kmv <boolean>   keep motion vector for 2D motion blur on/
off

useFileCache          -uf  <boolean>   use the tessellation file cache

optimizeInstances     -oi  <boolean>   dynamically detects similarly
                                       tessellated surfaces

reuseTessellations    -rut <boolean>   reuse render geometry to
                                       generate depth maps

useDisplacementBbox   -udb <boolean>   use the displacement bounding box scale t
o
                                       optimize displacement-map performance

enableDepthMaps       -edm <boolean>   enable depth map usage

enableRayTrace        -ert <boolean>   enable ray tracing

reflections           -rfl <int>       maximum ray-tracing reflection level

refractions           -rfr <int>       maximum ray-tracing refraction level

renderLayers          -rl <boolean|name>  render each layer separately

renderPasses          -rp <boolean|name>  render passes separately

renderSubdirs         -rs <boolean>    render layer output placed in subdirectories

shadowLevel           -sl  <int>       maximum ray-tracing shadow ray depth

edgeAntiAliasing      -eaa <quality>   The anti-aliasing quality of EAS
                                       (Abuffer). One of highest high medium low

useFilter             -ufil <boolean>  if true, use the multi-pixel filtering
                                       otherwise use single pixel filtering.

pixelFilterType       -pft  <filter>   when useFilter is true, identifies one of the
                                       following filters: box, triangle
                                       gaussian, quadraticbspline, plugin

shadingSamples        -ss  <int>       global number of shading samples
                                       per surface in a pixel

maxShadingSamples     -mss <int>       maximum number of adaptive shading
                                       samples per surface in a pixel

visibilitySamples     -mvs <int>       number of motion blur visibility samples

maxVisibilitySamples  -mvm <int>       maximum number of motion blur
                                       visibility samples

volumeSamples         -vs  <int>       global number of volume shading samples

particleSamples       -pss <int>       number of particle visibility samples

redThreshold          -rct <float>     red channel contrast threshold

greenThreshold        -gct <float>     green channel contrast threshold

blueThreshold         -bct <float>     blue channel contrast threshold

coverageThreshold     -cct <float>     pixel coverage contrast threshold
                                       (default is 1.0/8.0)

outputFormat          -of  <format>    output image file format. One of: si soft
                                       softimage, gif, rla wave wavefront, tiff
                                       tif, tiff16 tif16, sgi rgb, sgi16 rgb16
                                       alias als pix, iff tdi explore maya, jpeg
                                       jpg, eps, maya16 iff16, cineon cin fido,
                                       qtl quantel, tga targa, bmp

shadowPass            -sp <boolean>    generate shadow depth maps only

abortOnMissingTexture -amt             abort renderer when encountered missing texture

dontReplaceRendering  -rep             do not replace the rendered image if it already exists

verbose               -verbose <boolean> perform the render verbosely if on

iprFile               -ipr             create an IPR file

xResolution           -x   <int>       set X resolution of the final image

yResolution           -y   <int>       set Y resolution of the final image

xLeft                 -xl  <int>       set X sub-region left pixel boundary
                                       of the final image

xRight                -xr  <int>       set X sub-region right pixel boundary
                                       of the final image

yLow                  -yl  <int>       set Y sub-region low pixel boundary
                                       of the final image

yHigh                 -yh  <int>       set Y sub-region high pixel boundary
                                       of the final image

displayLayer          -l  <name>       one or more displayLayer names to render

numberOfProcessors    -n  <int>        number of processors to use. 0 indicates
                                       use all available.

tileWidth             -tw <int>        force the width of the tiles.  Valid valu
                                       are between 16 and 256.

tileHeight            -th <int>        force the height of the tiles.  Valid values
                                       are between 16 and 256.

                      -cont            allow renderer to continue when it hits errors

                      -keepPreImage    keep the renderings prior to post-process around

    *** Remember to place a space between option flags and their arguments. ***
Any boolean flag will take on, yes, true, or 1, as TRUE,and off, no, false, or 0 as FALSE.

    e.g. Render -x 512 -y 512 -cam persp -im test -of sgi -mb on -sa 180 file.ma


// End Of Render Flags