Launching Renders with Scripts


To launch a render for Maya, use the operating system's command line. On Windows, the Command Prompt can be found in the Start menu (All Programs > Accessories). On the Mac, open the Terminal window located under Applications > Utilities. Both of these commands execute a Maya render using the parameters stored in the Render Globals window.

To render a scene from the desktop:

  • On Windows, you can right-click a scene file and select "render" from the pull-down menu that appears (Figure 16.107).

    Figure 16.107. Right-click a scene file in Windows and select "render" to launch a render outside of the Maya GUI.


To render from the command line:

1.

From the Windows Start menu, select All Programs > Accessories > Command Prompt.

The Command Prompt window opens (Figure 16.108).

Figure 16.108. The Windows Command Prompt.


2.

Type render -h into the Command Prompt and press .

A long list of parameters is printed for the render command (Figure 16.109).

Figure 16.109. Type render -h to display all the parameters for the render command.


3.

Type render myscene.mb into the Command Prompt to render your scene.

This assumes that the parameters in the Render Globals window do not need to be changed. Your scene file must either be in the current directory or in the directory that the command prompt has open.

4.

On Windows, specify the full path of where your scene file is stored using the following script (Figure 16.110):

Figure 16.110. Windows uses backslashes(\) to separate folders in path names.


 render C:\myproject\scenes\myscene.mb 

or

On the Mac, specify the path as in Figure 16.111 using the following script:

Figure 16.111. The Mac uses forward slashes(/) to separate folders in path names.


 render /Users/username/myproject/scenes/myscene.mb 

Avoid any blank spaces in the file path because they will cause problems.

5.

Add the start and end frame flags to the render command in the Command Prompt:

 Render s 1 e 100 myscene.mb 

This command will render frames 1 through 100.

Tip

  • The render flag dontReplaceRendering (rep) tells the renderer not to write over a frame if it is already in the output directory.

     Render rep s 1 e 100 myscene.mb 

    This allows several computers to render the same scene to the same directory and effectively create a simple distributed rendering network. For more information, see the Network Rendering sidebar below.

    When executing several renders, one after the other, it is much easier to launch them using some form of scripting. On Windows, you need to create a bat (batch) file that uses NTscript. This is basically a text file that contains one render command after another. On Mac OS X, you will create a shell script instead, which is only slightly different from a bat file.


To create a Windows bat script:

1.

In a Windows directory, right-click and choose New > Text Document from the pull-down menu that appears (Figure 16.112).

Figure 16.112. Create a text file to use as a bat (batch) file.


A text file appears with its name highlighted, indicating that it can be renamed.

2.

Enter the name myscript.bat and press (Figure 16.113).

Figure 16.113. Rename the file myscript.bat.


You can name the file anything you like, as long as it ends with .bat.

3.

Right-click the file and select Edit from the pull-down menu that appears (Figure 16.114).

Figure 16.114. Right-click the file and select edit from the menu.


The script opens in Notepad.

4.

Using the syntax from the step 4 of the previous task, "To render from the command line," enter a render command for each scene you need to render.

5.

Add the pause command to the end of the script so that you can see the results of the commands after they are executed (Figure 16.115).

Figure 16.115. Add pause to the end of the script so that it will not close when it's done.


6.

Save the file and double-click it to execute it.

The render command is executed and the progress is printed in the command prompt.

To create a Mac OS X shell script:

1.

From the Applications menu, choose Utilities and double-click TextEdit to create a new document.

2.

From the Format menu, choose Make Plain Text to switch from Rich Text Format (RTF) to Plain Text Format (Figure 16.116).

Figure 16.116. Select Make Plain Text from the Format menu to remove the unnecessary Rich Text Styles that will prevent the script from running normally.


RTF files store a lot of extra information, like font, size, and type, which we don't need.

3.

Using the syntax from step 4 of the task "To render from the command line," enter a render command for each scene you need to render (Figure 16.117).

Figure 16.117. Enter a render command for each scene you need to render.


4.

From the File menu, choose Save As and enter the name myrenderscript.command in the dialog box that appears.

5.

Click Save to save the script to your hard drive, and in the Warning dialog box that appears, click Don't Append.

6.

From the Applications menu, choose Utilities and double-click Terminal (Figure 16.118).

Figure 16.118. Open the Mac OSX Terminal window to launch a render without Maya being open.


The Mac OS X Terminal window opens with a text prompt where you can enter commands (Figure 16.119).

Figure 16.119. The Mac OS X Terminal window opens with a text prompt where you can enter commands.


7.

Type ls l and press .

A list of scripts appears on the screen, giving you the permissions for all the files in that directory (Figure 16.120).

Figure 16.120. Typing ls l into the Terminal window list the contents of the current directory.


8.

From the Mac OS X Terminal window, run the command chmod on your script to make it executable.

 chmod +x myrenderscript.command; 

(Figure 16.121).

Figure 16.121. Running the chmod +x command on the script makes it executable.


9.

Type ls l again and you will now see an x at the end of the permissions section of your files (Figure 16.122).

Figure 16.122. Running ls l again reveals that the script has been made executable.


This changes the permissions on the script so that it executes when the name of the file is typed into the Mac OS X Terminal window or double-clicked in a directory.

Networking Rendering

Larger projects will require many hours to render. Using several computers to render a single animation will greatly speed up the process. The Windows and Mac versions of Maya do not come with network rendering software. However, there are several commercial and free applications that make it easy to render across multiple computers.

In order to use several computers in a rendering network, you will need a 100 baseT (or faster) network with a network switch as opposed to a hub. If you're only using two different software products, you can use a crossover cable.

You'll also need to have Maya installed on each computer or have it properly installed on a server. You do not need additional licenses to use the Maya Software, Vector, or Hardware renderers on multiple systems. However, for the Hardware renderer, each system should have the same display card installed; otherwise, there may be differences between the frames that each system renders. Mental Ray requires a license for each system, and any plug-ins will need to be installed and properly licensed.

The path to the project directory also needs to be same between each system. On Windows, this can be accomplished by assigning the network drive a common letter between all the systems. On the Mac, create a common link on each computer pointing to the same drive on the network. Then, using network rendering software, packets of frames can be rendered by each computer to the common project directory.

Finally, here's a list of products and URLs that can help you get off to the right start.

Commercial distributed rendering programs for Windows and Mac OSX:

  • Rush (http://seriss.com/rush/)

  • Muster (http://www.vvertex.com)

  • Lemon Pro (http://martin.ice.org/lemon_pro.html)

Commercial distributed rendering programs for Windows:

  • Smedge2 (http://www.uberware.net/)

  • Rendermax (http://www.rendercorp.com/)

Free distributed rendering programs for Mac OSX:

  • Farm Manager by Dave Schmitz (http://www.schmitzware.org/indexFarmManager.html)

Free distributed rendering programs for Windows:

  • Spider (http://groups.yahoo.com/group/SXSpider)




    Maya for Windows and Macintosh
    MAYA for Windows and MacIntosh
    ISBN: B002W9GND0
    EAN: N/A
    Year: 2004
    Pages: 147
    Authors: Danny Riddell

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net