Batch rendering is the process of rendering out maya scene files without using the interface. It allows you to start renders,
as well as change some of the attributes of the rendering software.
The "render" commmand is the command to start a render. By typing "render -help" in a windows command shell. You can see a breif description of the render command, and all of its flags. The flags what allow you to change what the render command does " -help" is the flag for help.
If you open a command prompt in a directory with the
scene file you wish to render, you can simply type in
"
render mySceneFile.mb" mySceneFile.mb being the name of the file. This
will use the render globals that were
set in that scene file, it will also try and figure out which project directory
to use, if it can't, it will use the last project file you
set.
Although useful, starting renders this way isn't all
that helpful. What can be more helpful is createing a
bat or batch file that can be used over and over again.
To create a batch file, open up wordpad or notepad to
a new text file. In this you will type the render command
along with several flags that you can be very specific with the most common
flags are the following:
Common Options:
-help Print help
-test Print MEL commands but do not execute them
-verb Print MEL commands before they are executed
-keepMel Keep the temporary MEL file
-listRenderers List all available renderers
-r <string> specify which renderer to use (the command above tells you
your options for this command)
-proj <string> use this Maya project to load the file
-log <string> save render diagnostics into the given text file
General Purpose Flags:
-rd <path> Specify the directory in which to output image files
-im <file name> Image file output nam
-fnc <int> File naming convention (eg: name, name.ext, name.#)
-of <string> output iimage file format
-s <float> set start frame
-e <float> set end frame
-b <float> by frame (eg: -b 2 renders every other frame)
-pad <int> number of digits in the output image frame file name (01,
001, 0001, etc)
-rfs <int> Specifies what number to start the image sequence at. Overrides
the frame number from the scene file.
-rfb <int> Specifies what increment to renumber the image sequence at.
Overrides the frame number from the scene file.
-se <int> Obsolete flag identical to -rfs, used only for backward compatibility
-be <int> Obsolete flag identical to -rfe, used only for backward compatibility
-cam <string> specify which camera to be rendered
-rgb <boolean> turn RGB output on or off
-alpha <boolean> turn Alpha output on or off
-depth <boolean> turn Depth output on or off
-iip ignore image planes
-x <int> set x resolution of the final image
-y <int> set y resolution of the final image
-precentRes <float> renders the image using a percent of the resolution
-ard <float> set device aspect ratio for the rendered image
Software Specific Flags:
Anti-aliasing:
-eaa <int> Set anti-aliasing quality: 0=highest, 1=high, 2=medium,
3=low
-ss <int> global number of shading samples per surface in a pixel
-mss <int> maximum number of adaptive shading samples per surface in
a pixel
-mvs <int> number of motion blur visibility samples
-mvm <int> maximum number of motion blur visibility samples
-pss <int> number of particle visibility samples
-vs <int> global number of volume shading samples
-ufil <boolean> If true, use multi-pixel filtering; otherwise, use
single pixel filtering
-pft <int> when useFilter is true, specifies on of the following filters:
0=box, 2=triangle, 4=gaussian, 5=quadratic
-pfx <float> when useFilter is true, defines the X size of the filter
-pfy <float> when useFilter is true, defines the Y size of the filter
-rct <float> red channel contrast threshold
-gct <float> green channel contrast threshold
-bct <float> blue channel contrast threshold
-cct <float> pixel coverage channel contrast threshold (default = 1.0/8.0)
Ray Tracing:
-ert <boolean> turn raytracing on and off
-rfl <int> maximum raytracing reflection level
-rfr <int> maximum raytracing refraction level
-sl <int> maximum raytracing shadow ray depth
Field Options:
-field <boolean> enable field rendering; when on, images are interlaced
-pal when field rendering is enable, render even field first (PAL)
-ntsc when field rendering is enable, render odd field first (NTSC)
Motion Blur:
-mb <boolean> motion blur on/off
-mbf <float> motion blur by frame
-sa <float> shutter angle for motion blu (1-360)
-mb2d <boolean> motion blur 2D on/off
-bll <float> 2D motion blur length
-bls <float> 2D motion blur sharpness
-smv <int> 2D motion blur smooth value
-smc <boolean> 2D motion blur smooth color on/off
-kmv <boolean> keep motion vector for 2D motion blur on/off
Render Options:
-ifg <boolean> if false, use the film gate for rendering
-edm <boolean> enable depth map usage
-g <float> gamma value
-premul <boolean> premultiply color by the alpha value
-premulthr <float> when premultiply is on, defines the threshold used
to determine whether or not to premultiply
Memory and Performance:
-uf <boolean> use the tessellation file cache
-oi <boolean> dynamically detects similarly tessellated surfaces
-rut <boolean> reuse render geometry to generate depth maps
-udb <boolean> use the displacement bounding box scale to optimize
displacement-map performance
-mm <int> renderer maximum memory use (in Megabytes)
Render Layers and Passes:
-rl <boolean>|<name(s)> render each render layer separately
-rp <boolean>|<name(s)> render passes separately. "all" will
render all passes
-rs <boolean> obselete flag, used only for backward compatibility
-sel <boolean>|<name(s)> selects which objects, groups, and/or
sets to render
-l <boolean>|<names> selects which display and render layers
to render
MEL callbacks:
-preRender <string> Mel code executed before rendering
-postRender <string> Mel code after before rendering
-preLayer <string> Mel code executed before each render layer
-postLayer <string> Mel code executed after each render layer
-preFrame <string> Mel code executed before each frame
-postFrame <string> Mel code executed after each frame
-pre obsolete flag
-post obsolete flag
Mental Ray Specific Flags:
-v <int> set the verbosity level 0 = fatal errors only; 1 = all errors;
2 = warnings; 3 = progress report; 4 = informational messages; 5 = debugging
messages; 6 = detailed messages
-re <int> specify number of rendering threads. 1-4
rnm <boolean> Network render option. If true, mental ray renders almost
everything on slave machines, thus reducing the workload on the master machines
-bakesSetDefault Specifies a bake-set to include all objects not assigned to
any other bake-set in the scene
Hardware Specific Flags:
Quality:
-ehl <boolean> enable high quality lighting
-ams <boolean> accelerated multi sampling
-ns <int> number of samples per pixel
-tsc <boolean> transparent shadow maps
-ctr <int> color texture resolution
-btr <int> bump texture resolution
-tc <boolean> enable texture compression
Render Flags:
-c <int> culling mode: 0 = per object; 1 = all double sided; 2 = all
single sided
-sco <boolean> enable small object culling
-ct <float> small object culling threshold
-mb <boolean> enable motion blur
-mbf <float> motion blur by frame
-ne <int> number of exposures
-egm <boolean> enable geometry mask
Other Flags:
-rep <boolean> if true, overwrite existing frames
-reg <int><int><int><int> Set sub-region pixel boundary
of the final image: left, right, bottom, top
-n <int> number of processors to use (0 indicates use all available)
-mf <boolean> append image file format to image name
-sp <boolean> generate shadow depth maps only
-amt <boolean> abort renderer when encountered missing texture
-ipr <boolean> create an IPR file
-keepPreImage <boolean> keep the renderings prior to any post-processing
(motion blur, glows, etc)
-renderer "which render to use" "sw" mayaSoftware, "hw" mayaHardware, "mr" mentalRay
-proj "project" this will set the project for
the render, this is important as it will tell maya where to find files as
well as put them, if it needs to or isn't specified. Generally you want to
use the entire path and enclose it in "" especially if there are
any spaces in the path.
ie: -proj "C:Documents and settings/smann/My Documents/maya/projects/audiProj/"
-rd "render directory" this will tell maya where to put the rendered images, its best not to rely on the project settings when running a batch render
-im "image file output name" the name of the rendered image files.
-fnc "file name convention" This tells maya
how to name the files
ie: name.#.ext name.ext.# etc. number 3 is name.#.ext which I recommend and most people use as a production standard
-pad "padding" the number of zeros in the # of the name 4 is standard
so 1 is 0001
-s "frame start"
-e "frame end"
-b "by frame" (almost always 1 unless you want to render by 2s or
3s which I will explain reasons why later)
-cam "specify the camera to render" not always needed but is a good saftey to use, so if you scene has multiple cameras with the renderable flag checked, they wont render"
-of "image format" ie: jpg sgi tiff tga
-n "number of procs to use" 0 will use all, I generally set this to 0, unless Im rendering something that wont work on multiple procs.
Ideally you would have set up your scene files so you didn't need to set up
all these flags, but most of the time were too busy and too overworked to
make sure we set our render globals correctly, every time. Plus, once we
set up a basic renderBatch file, its easily reusable for multiple scenes.
I prefer to use full paths so that I can start the batch file from any location
if I was in my scenes directory, I could just have the name of the file, but
I
would still want to use full paths for the proj and the renderDirectory.so
to render one scene, you would write a line as follows:
render -n 0 -r sw -proj "D:/projects/audiPRj/" -rd "D:/projects/audiPRj/images/shot010/" -im shot010_beauty -fnc 3 -pad 4 -s 101 -e 234 -b 1 -cam renderCam1 -of tga "D:/projects/audiPRj/scenes/shot010/lgt/shot010_lgt.mb"
this may seem like a giant line to write, but really its not much at all, and like I mentioned, once set up and can be reused for other scenes.
by adding mulitple lines you can render several scene files from one txt file. each line, being a new render. (for the sake of readabilty Im leaving off some of the flags, and not using the full paths) ie:
// start file
render -s 101 -e 200 -b 1 -im shot010_beauty -fnc 3 -pad 4 -cam renderCam1
shot010_lgt.mb
render -s 201 -e 230 -b 1 -im shot010_beauty -fnc 3 -pad 4 -cam renderCam2
shot010_lgt.mb
render -s 231 -e 300 -b 1 -im shot010_beauty -fnc 3 -pad 4 -cam renderCam3
shot010_lgt.mb
render -s 101 -e 200 -b 1 -im shot020_beauty -fnc 3 -pad 4 -cam renderCam1
shot020_lgt.mb
render -s 101 -e 200 -b 1 -im shot030_beauty -fnc 3 -pad 4 -cam renderCam1
shot030_lgt.mb
// end file
the above will render shot1 frames 101 through 300 with 3 different cameras. naming all the files the same and then it will render shot2 frames 101 through 200 and then render shot3 frame 101 through 200
save this text file as a simple text , and then change
the ext from txt to bat so renderBatchOne.txt is changed to renderBatchOne.bat,
upon the name change the icon for the text should change into a little yellow
cog. Double clicking this file will cause the batch to start,
and render all these scenes. You can also start the batch by opening a command
prompt in the directory with the batch file, and typeing in the name of the batch
file. This will run the batch, but leave the command prompt open, so you can
read
all the results, and if any, errors.
-----------------------------------------------------------------------------------------------------------------------------
RENDERING ON MULTIPLE MACHINES
If you want to split your renders between multiple machines, you have to start them manually, " other wise you will need to use a queing program like smedge, or rush"but it can be very easy to do. In the same directory you can create several different batch files, In this case I would name them with the name of the computer, ie: deluxe_shot010Batch.bat superb_shot010Batch.bat etc. I would then runthose batch files on the respective machines.
Often when rendering on different machines I will render odd frames on one, and even on the other.that way mid way through the render I can watch more of my progress, rather than watching only the 0-30 and 100-130 I can view 0-60 which can be more beneficial. to do this I change the by frames of the render. on "deluxe" I will set the -s 0 -e 99 -b 2 and on "superb" I will set -s 1 -e 200 -b 2.
---------------------------------------------------------------------------------------------------------
MAYA FLAGS
C:\Documents and Settings\Administrator> render -
help
Unknown Maya Render Flag '-'
Remember to place a space between flags and their arguments.
Usage: 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 image
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 to
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, triangl,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 values 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.mp
------------------------------------------------------------------------------------------------------------
I would love to give credit to the person who gave me these notes, but for the life of me, I can't remember. I think it was Dave. Thanks!