The first example starts a command-line render using Windows:
1. Go to the Windows Start menu, and choose Start All Programs Accessories Command Prompt to open the Command Prompt shell.
2. Use Windows Explorer to browse your computer’s directory: right-click the Start button, and choose Explore to open Windows Explorer.
3. Open the scenes folder in your current project where you placed the solarSystem_v01.ma scene.
4. Select the Address line at the top of Windows Explorer, and choose Edit Copy to copy the path to the scenes directory to the clipboard.
5. At the command prompt, type cd ..\.. and hit Enter. This sets the command prompt to the root directory.
6. Type cd and then a space; next right-click the command line and select Paste. This pastes the path to the scenes directory in the command prompt.
7. Press the Enter key to set the current directory to the scenes directory (Figure 12.47).
When starting a batch render, you can either specify the path to the scenes directory in the command-line options or set the command prompt to the directory that contains the scene.
To start a batch render, use the render command in the command prompt followed by option flags and the name of the scene you want to render. The option flags are preceded by a hyphen.
The flags are followed by a space and then the flag setting. For example, to start a scene using the mental ray renderer, you would type render -r mr myscene.ma. The render command starts the batch renderer, the -r flag specifies the renderer, and mr sets the -r flag to mental ray.
The command ends with the name of the scene (or the directory path to the scene if you’re not already in the directory with the scene).
There are a large number of options, but you don’t need to use them, except if you want to specify an option that’s different from what is used in the scene. If you want all the layers to render using mental ray regardless of the layer setting in the scene, then you specify mental ray using the -r mr flag. If you omit the -r flag, then Maya uses the default renderer, which is Maya Figure 12.47
Set the command prompt to the current directory where the solarSystem_
v01.ma scene is stored (the exact directory path will look different on your machine).
Software. If you have a scene with several layers that use different renderers (as in the case of the solarSystem_v01.ma scene), then you would type -r file. This sets the renderer to what- ever is specified in the file, including what is specified for each layer.
Other common flags include the following:
-s <float> sets the start frame. (It replaces <float> with the starting frame; for example, -s 120 would set the start frame to 120. A float is a number with a decimal point.)
-e <float> sets the end frame.
-x <int> sets the X resolution of the image. (An integer is a whole number without a decimal point.)
-y <int> sets the Y resolution of the image.
- cam <name> sets the camera.
-rd <path> specifies the directory for the images. (If this is not used, the directory in the project settings is used.)
-im <filename> sets the name of the rendered image.
-of <format> sets the image format.
There is a complete list of the flags in the Maya documentation. You can also print a descrip- tion of commands by typing render -help. To see mental ray-specific commands, type render -help -r mr.
For example, if you want to render the scene using renderCam1, starting on frame1 and end- ing on frame 24, type the following in the command prompt (Figure 12.48):
render -r file -s 1 -e 24 -cam renderCam1solarSystem_v01.ma
You’ll see the render execute in the command prompt. When it’s finished, you can use FCheck to view each sequence. In the Images folder, you’ll see two directories named after the layers in the scene. The orbitPath directory has the Paint Effects orbit paths rendered with Maya Software. The solarSystem directory has the rendered sequence of the planets and sun as well as subdirectories for the diffuse, incandescence, and MasterBeauty passes (the MasterBeauty pass is created by default when you add passes to a scene).
Figure 12.48 Enter the render command with options and the scene name in the Command Prompt window.
Let’s say you want to render only the orbitPaths layer using renderCam2 for the frame range 16 to 48. You want to specify Maya Software as the renderer. You may want to name the sequence after the camera as well. Type the following into the command prompt (use a single line with no returns):
render -r sw -s 16 -e 48 -rl orbitPaths -cam renderCam2 -im solarSystemCam2 solarSystem_v01.ma
mAc cOmmAnd-line render
For a Mac, the Maya command-line render workflow is similar except that instead of the com- mand prompt, you use a special Terminal window that is included when you install Maya. This is an application called Maya Terminal.term, and it’s found in the Applications\ Autodesk\
Maya 2011 folder (Figure 12.49). It’s probably a good idea to add this application to the Dock so you can easily open it whenever you need to run a batch render.
You need to navigate in the terminal to the scenes directory that contains the scene you want to render:
1. Copy the solarSystem_v01.ma scene from the DVD to the scenes directory of your cur- rent project on your computer’s hard drive.
2. In the Finder, open the current project directory.
3. Start the Maya Terminal application, and type cd at the prompt.
4. In the Finder, drag the scenes folder from the current project on top of the Maya Terminal. This places the path to the scenes directory in the Terminal.
5. Press the Enter button. The Terminal window is now set to the project’s scenes folder, which contains the solarSytem_v01.ma scene.
The commands for rendering on a Mac are the same as they are for Windows. You can con- tinue starting with step 6 in the previous exercise.
Figure 12.49 The Maya Ter- minal window is installed with Maya in the Maya 2011 folder.