In this Quick Tip tutorial, you will learn how to batch render Maya scenes faster using the Windows command line, and in this way, maximize the amount of processing power you can get from your computer.
First if you’re using Windows 7, and the latest version of Maya 2010, you need to set the path of the mayabatch to the systems’ Environment Variables. Right click on ‘Computer’ and select ‘Properties’. In the window that opens, click on ‘Advanced System Settings’.
In the window that pops up, select the ‘Advanced’ tab on top, and then click on ‘Environment Variables’.
Under ‘System Variables’, scroll and find the one with the name ‘Path’, select it, and click the ‘Edit’ button.
In the window that comes up next to ‘Variable value:’, scroll to the end of the field, and add ‘;’ plus the path to your Maya directory (and its ‘bin’ folder). By default the directory is ‘C:\Program Files\Autodesk\Maya2010\bin’ Then click ok on all of the windows to close them.
When rendering your file through the command line, the batch renderer will take all of the settings from the Maya file. These include settings in the render options, such as: the file name of the output files, image format, frame padding, start and end frames, renderable cameras, image size, and all of the other quality and render settings in the render set up. It will also take the different render layers (if you have them), and overall all the information will come from this file.
Also the file's output directory will be the same as specified in the project of the file.
Now to open the command line, click on the ‘Start’ button, and then in the search field type ‘cmd’. The command line should show then show up. Click to open it. If you’re using XP, first click the ‘Start’ button, then select ‘Run’, and there type ‘cmd’ in the field.
Then, an easy way to batch render a file is to navigate to the folder with the particular file you want to render. Let’s say the folder is ‘C:\Users\Pipera\Desktop\Project\My Projects\Project’, and in that folder there’s a file called ‘Concept_Scene_1’. To render it, first you need to enter the directory type ‘cd’, and the name of the folder (in this case it will be ‘cd C:\Users\Pipera\Desktop\Project\My Projects\Project’). Now to render the file, just type ‘Render FileName_and_Extension.mb (for Maya Binary). In this case the command line will look like this ‘Render Concept_Scene_1.mb’
In general, when rendering from the command line, the batch renderer will always take the settings from the file. But there’s a way to edit the settings if you need to, without opening the file again and saving it. These settings are called 'flags', and are typed after the ‘Render’ command and before the file name. These flags won’t change your file, just the render that you’re going to output. To see all the different flags, open the command line and type ‘Render –h’
The only settings that are going to change are the ones that are overridden with flags. Let’s say you need to change the size of your image, and you want to render with mental ray. In the command line type ‘Render –r mr –s 1 –e 125 Concept_Scene_1.mb’, where the ‘-r’ flag specifies which render to use (in this case ‘mr’ for mental ray), the ‘-s’ is the start frame of the animation, and the ‘-e’ is the end frame.
Now for a more efficient way of rendering with Windows executable .bat files. These files are made and edited in Notepad. Let’s say that you want to render a file with mental ray. In Notepad write ‘Render –r mr Concept_Scene_1.mb’ and save the file, but make sure in the end of the name to put ‘.bat’, so that the file can save in a .bat format.
Put the .bat file in the same folder as the file you want to render, and double click it to run the batch renderer.
Using .bat files is great when you need to render several scenes that are in different directories. And what's more, you can put different flags for each scene. It doesn’t matter where you put the .bat file, because the directories are listed within it. Also, the scenes will render consequently.
With the ‘-rd’ flag, you can specify in which directory your files are going to be rendered.
The ‘-rd’ flag can also be used for multiple files at the same time.
Another highly useful flag is the ‘-cam’ flag, which lets you specify which camera to render from the scene.
You can render as many cameras as you like from the same or different scenes, and also put different flags to make it even more efficient.
Rendering different cameras is even better when combined with the ‘-rd’ tag, so each camera will be output into a different folder
Remember that you can combine as many flags as you want to speed up your renders, and then you can view the commands when you type ‘Render –h’ in the command line.
Some final useful tips for rendering from the command line: Don't use spaces in the name of the files always put an ‘_’ instead; Make sure that the .bat files are saved with their extension after the name; If you want to stop the render process, just close the command line.