banner
border
Home
Gallery
Reel
Tutorials
Resume
Contact
Links
border
Tutorials
 
 

Command Line Rendering

There are various benefits to rendering using the command line instead of though Maya and this tutorial will guide you through the process on a windows operating platform.
If you have a scene that is particularly complex scene or render then having the extra available memory that Maya would have been using if it were open can really help. Using the command line method is also a quick way to change settings for your rendering of multiple files. If you needed to render a low-res preview for a client for example you could do that using this rendering technique rather than having you open up a series of files to edit them all individually.

The feature about rendering from the command line that personally I find to be most valuable is that it allows you to set-up a render queue.
You can have multiple scene files, for example different shots or render passes and have them render one after another. So you don’t need to baby-sit your computer while rendering.

Getting started…

First of all it’s best to make sure all your setting in the render globals are how you want them. We can edit them via the script we are about to make but having then already how you want them means you have to write less script and just use script to edit or tweak settings.
Once you have the render globals how you want them you need to create a new text document with either ‘notepad’ or ‘WordPad.’ In this document we are going to write a list of all the different files you wish to render and any changes to the render settings you wish to make.

This is an example of the type of text you would need to write...

Render -renderer sw myMayaScene_01.mb

In the example above shows a Maya software render of the file ‘myFile_01.mb’ the ‘sw’ tells the render engine that you want to use Maya software renderer. If you wish to use mental ray to render then all you need to do is replace the ‘sw’ with ‘mr.’

*Note* if a file name has a space in it then this will not work, although you can use underscores or hyphens.

To set it up to render multiple files consecutively all you need to do is create a command on the line below you can do this as many times as you like.
Illustrated below…

Render -renderer mr myMayaScene_01.mb
Render -renderer sw myMayaScene_02.mb
Render -renderer mr myMayaScene_03.mb
Render -renderer mr myMayaScene_04.mb

Now then you execute this render it will render them out in the order you have listed them. If for any reason one render fails the render engine will stop rendering it and move on to the next in the list.

Editing the Render Globals though the command line script

Editing the Render Globals though the command line script

Using this technique allows you to edit the way your scenes render without having to open the files themselves is a very quick and powerful method especially when you have lots of separate scenes you wish to render.

To edit the render globals you need to add ‘flags’ in to the command line. Below is an example for the previously made script but with the added functionality of rendering it out at half the resolution set in the Maya files render globals…

Render -renderer sw -percentRes 0.5 myMayaScene_01.mb

Above you can see an extra command has been added ‘-percentRes 0.5’ this tells the rendering engine to reduce the size to half.

*Note* when it comes to adding flags the order is not important, as long as all the flags are between ‘render’ at the beginning and the Maya file name at the end.

You can add more flags to control the output of your renders, other common and useful flags are…
(examples in yellow)

*Edit rendering start frame: –s
Render -renderer sw –s20 myMayaScene_01.mb
Starts rendering a frame 20

*Edit rendering end frame: –e
Render -renderer sw –e130 myMayaScene_01.mb
Finishes rendering at frame 130

*Change directory rendered files are saved to: -rd
Render -renderer sw -rd c:\maya\Project\images myMayaScene_01.mb
Images now rendering to directory c:\maya\Project\images

*Change rendered images name: -im
Render -renderer sw -im myNewRender myMayaScene_01.mb
Images rendered are now named 'myNewRender'

*Note* for more flags please download the word document version of this tutorial found at the bottom of this tutorial.

Executing the script

Once you have the script you need to save it and then rename the file extension to ‘.cmd
If you used notepad then you need to change the ‘.txt’ part with ‘.cmd’ and for WordPad users you need to change the extension from ‘.rft’ to ‘.cmd

The icon that windows uses for the file now should have changed to one with a cog in it. Your script is now ready to use, double click on it and it will begin to render.


 

Download tutorial -
Download
     

 

 

Footer