The goal here is to have Mental Ray process our scene using distributed rendering to neighboring computers in the lab. We also want to maximize the amount of RAM available for this by not requiring Maya to be open (sucking up memory in the process). This means we need to use the Terminal, often called "the shell."
In order to call Maya's "render" command at the Terminal, you need to add the path to maya's render command to your bash profile.
- 1. Open /Applications/Utilities/Terminal. A new terminal window will open and you will automatically be at your home directory (/Users/<username>).
2. At the command line you will type case-sensitive commands. Type:3. Select the text below, copy it to the clipboard, and paste it into the pico editor document you just created with the previous command:
Code: Select all
pico .bash_profile4. In the pico editor, type: "control + o" to save the file into your home directory.
Code: Select all
5. Press ENTER when it says "File Name to Write: .bash_profile".
6. Now type "control + x" to exit pico.
7. Now, close the terminal window and reopen a new terminal window. This will cause the terminal (actually the "shell") to recognize the path variable you just set with the commands above. If it doesn't complain when you open a new window, you have just successfully added Maya's command-line tools to your path. Now you can type the word "render" at the command-line, followed by some arguments, and Maya will do things for us without having to gobble up RAM launching the Maya interface!
NOW WHAT? A newbies guide to using the command-line:
- 1. Now we need to change directories to your Maya projects "scene" directory. At the terminal, type the command: "cd " without the quotation marks, but include the space after the d. "cd" is the command for change directory.
2. Open a Finder window and locate your Maya project scenes directory. Click and drag the directory (folder) from the Finder to the terminal window. This will automatically enter the path at the command-line!
3. Press ENTER. Now you are in your scenes directory and we can execute commands like launching scenes from here. If you type "ls" in the terminal, you'll see a listing of the directory contents and you'll notice your Maya scene file.
4. At this point, to start a batch render you will type a command that looks something like this:5. Substitute your scene name for <myscene> in the command above. If your scene is a binary file, the suffix will be .mb.
Code: Select all
render -r mr -s 1 -e 10 <myscene>.ma
6. You can manually set the range of frames you want to render by changing the numbers following the flags "-s" and "-e". The "s" and "e" stand for start and end. If you set these in your scene file the last time you saved it, you don't HAVE to set these, but it's an option. You could just type "render <myscene>.ma" and Maya will render however the scene file was configured within Maya.
7. The "-r mr" tells Maya to render using the Mental Ray renderer.
8. If you properly "Set Project" in Maya, your images will be rendered to the "images" directory, in the appropriate sub-folders.
There are other ways to do this. You can set up batch scripts and all sorts of other things, but this will get you going.
FIRST TIME SETUP FOR LAB (notes to myself on how to get it working in the lab - ignore this if you are a student)
1) Install Mental Ray Satellite on all local machines that you want available for distributed rendering.
2) Edit, copy or create a maya.rayhosts file and put it in your home directory. See included example.
3) Initiate the render via the command line manually like this:
/Applications/Autodesk/maya2011/Maya.app/Contents/bin/Render -r mr -s 0 -e 720 /Volumes/space/maya/projects<projectdirectory>/scenes/<scenename>.ma
Create a shell script and embed your command and set execute permissions: See attached render.sh
NOTE: For Maya 2011 the port number in maya.rayhosts is 7411, for Maya 2013 it's 7413