Quick Tip – Render Faster using the Windows Command Line with Maya

Quick Tip – Render Faster using the Windows Command Line with Maya

Tutorial Details
  • Software: Autodesk Maya
  • Difficulty: Advanced
  • Estimated Completion Time: 30 Minutes

Final Product What You'll Be Creating

This entry is part 5 of 5 in the Ivan Krushkov Session
« Previous

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.


Step 1

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’.

Step 2

In the window that pops up, select the ‘Advanced’ tab on top, and then click on ‘Environment Variables’.

Step 3

Under ‘System Variables’, scroll and find the one with the name ‘Path’, select it, and click the ‘Edit’ button.

Step 4

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.

Step 5

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.

Step 6

Also the file’s output directory will be the same as specified in the project of the file.

Step 7

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.

Step 8

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’

Step 9

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’

Step 10

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.

Step 11

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.

Step 12

Put the .bat file in the same folder as the file you want to render, and double click it to run the batch renderer.

Step 13

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.

Step 14

With the ‘-rd’ flag, you can specify in which directory your files are going to be rendered.

Step 15

The ‘-rd’ flag can also be used for multiple files at the same time.

Step 16

Another highly useful flag is the ‘-cam’ flag, which lets you specify which camera to render from the scene.

Step 17

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.

Step 18

Rendering different cameras is even better when combined with the ‘-rd’ tag, so each camera will be output into a different folder

Step 19

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.

Step 20

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.

Don’t miss more CG tutorials and guides, published daily – subscribe to Cgtuts+ by RSS.

  • Yeman

    Thanxxx Sir….It really Helpful for us….
    Is there any way to use this trick with MAC OSX with TERMINAL. If you know then please tell. it very thankful to us because i am using MAC version of MAYA 2010.

  • Abojung

    Ok, so u mean render fast. lets see, if this works, then sud be gr8.

  • http://psdho.me PSDhome – Everyday free PHOTOSHOP files

    This is great tip. Thank you for sharing with us.

  • darshana

    we must save the batch file in near the maya file or differant place?

    i mean i rly wanna tel ya because i didnt understand 100% in this tutorial. if you can please do a video tutorial or if you can give step by step siomplyfy the workflow at the end. . .

    please if you can re post it . . . . :)

    nice work . .

  • http://arlingtoncruz.blogspot.com Arlington Cruz

    Thanks a lot. This is extremely useful. I remember our teacher showing us how to do this at school a few years back at an intro to maya class. I had forgotten how to do it. Will save from you notes. really appreciate it .

  • http://silence.regnareb.com Regnareb

    Personally I use Backburner, you can see the progression of each renders, add some render to the queue, make some priorities between all the renders, cancel a specific render, and do some networks renders.

  • frankyframe

    ok and for mac ?? :D

  • Dmitri

    Good article. Possibly something to add- Mental Ray verbosity settings. By using the -v flag, you can have messages printed to the console (e.g. progress messages).

    -v set the verbosity level:
    0 = No messages;
    1 = Fatal Errors;
    2 = Non-Fatal Errors;
    3 = Warning Messages;
    4 = informational messages;
    5 = progress messages;
    6 = debugging messages;
    7 = verbose debugging messages;

  • Balaji

    Thanks Ivan!

    Can we do this process in 3ds max? If Possible means Please mention here!

  • Deacon

    What’s the difference between this and rendering by right clicking on the file and then render? It seems to me the same thing but easier.

  • http://silence.regnareb.com Regnareb

    Can you queue renders or use special attributes with right click ? I don’t think.

  • http://www.iuliuhorga.6te.net Iuliu

    have you got a tutorial for those who are using Maya in Linux?
    thanks

  • http://www.tommyvision.com redherring

    The location of the render command must be specified when using terminal to render under OSX:

    (Substitute the Uppercase commands for those relevant on your own system)

    /Applications/Autodesk/maya2011/Maya.app/Contents/bin/Render /Volumes/DRIVE_name/USER_name/Documents/maya/projects/PROJECT_name/scenes/SCENE_name.mb

    For a quick way to add the scene_name.mb file to the terminal prompt, navigate to the scene location using the finder, select the file and drag it onto the terminal window.

  • http://cg.tutsplus.com/tutorials/autodesk-maya/quick-tip-render-faster-using-the-windows-command-line-with-maya/ Muhammad zaki

    If it will be a downloadable PDF file. so it will be good !

  • Ed

    hello, i had batch render maya2009 with cmd before. however, i follow d tut, and i can’t do with maya2011(64) running win7 . i add the path, and cmd spits can’t find file

  • jordan

    everytime I try and run the .bat file the command prompt keeps using the old 2009 one and not my current 2011. help

  • ACurrie

    Ahh! You just saved me! I’d read on other sites how to batch renders with the command line but nobody had mentioned the environment variables step, so I was getting strange errors. Thanks so much!

    Here’s the error I was getting, in case anyone does an internet search for the same problem:
    cannot open renderer description file mrRenderer.xml

  • wenchi

    thanks for your sharing..
    this really helps me a lot

  • walid

    thaaanks for sharing =)
    just a question, how can that be faster than the ordinary rendering ?

  • k

    Thanks for the tut!

    But i’d just like to mention that you are using the word “EFFICIENT” wrongly i think. Batch rendering from commandline is only more efficient because you don’t have the scene open in maya, so you’ll have a bit more available ram, but besides that, no speed increase.

    Nevertheless, it’s a great and simplistic way to setup renders and I recommend it! Just don’t go throwin the word “efficient” in place of the word “convenient” or “slick” ;)

    thnks again!

  • NN

    If you can tell me what should I change in cmd line if I want to render with VRay in maya, because of materials, it’s recognizes just maya materials…(VRay Mtl – This shader type is unsupported Please assign a blinn lambert phong or anisotropic )… ? If you can help me

    • Aevar Gudmundsson

      To render with v-ray on the command line you simply do Render -r vray

      • issac

        Just Right click on file and click render. No need to type at all.

        Ha Ha Ha. Why this much long tutorial for it?

  • http://www.tkraus.cz tkraus

    Thanks! The information about settings the path is very useful.

    • issac

      3 Steps for cmd rendering

      1. Open the folder where the maya file is store (assuming while saving you set frames and other settings)

      2. Right click over it

      3. Click Render . Done

      It will take all settings of your render globe Setting and render it in cmd.
      Remember it will not increase render speed, only decrease memory consumption.

      It is as simple as it sound. Try and reply.

  • max

    )))))))))))))))))
    windows 7, 64 bit, >>> STILL NOT WORKING !!!
    ;D)))))))))))))))))
    Idonno what to do, find myself coming at night a few times to babysit renders !!
    WDF ??

    • issac

      3 Steps for cmd rendering

      1. Open the folder where the maya file is store (assuming while saving you set frames and other settings)

      2. Right click over it

      3. Click Render . Done

      It will take all settings of your render globe Setting and render it in cmd.
      Remember it will not increase render speed, only decrease memory consumption.

      You will get amazed . It is so simple. Try and reply.

  • santanu

    my problem is—-in my one layer i used mental ray renderer & other layer i choose maya software render as layer override …….. problem is when i use mental ray render flag both layer is rendering in mental ray….. this is a new issue have not faced in maya 2009

    • issac

      3 Steps for cmd rendering

      1. Open the folder where the maya file is store (assuming while saving you set frames and other settings)

      2. Right click over it

      3. Click Render . Done

      It will take all settings of your render globe Setting and render it in cmd.
      Remember it will not increase render speed, only decrease memory consumption.

      No need to do all this. Try and reply.

      • TFM

        That is short sighted. People need this command line functionality to perform automated renders. That is the whole point of this article.