This is a quick step-by-step intro showing how you can render single frames or animated sequences in maya from the command line. This has several advantages:

all you have to do is follow these simple steps


Simple command-line rendering


step 1: set up

For a quick simple example, you only need to make sure you have your scene set up correctly in maya, and then make one small change to your shell environment before you can begin:

In maya:


step 2: add a directory to your path

you can either type those examples in every time you need them, or save yourself the keystrokes by putting them in your default rc files. for people who use bash, that's .bashrc. for people who use tcsh, that's .cshrc. If you don't know what shell you use, it's probably tcsh, so go ahead and try it with that. If it doesn't work, then you're probably using bash.

step 3: render

okay, now we're ready to render. Assuming you have a scene called Foo.mb, you can Render your scene like so:

Render Foo.mb

Simple, no? Well now that you've done that, let's talk about more advanced uses of this ability


Advanced uses of command-line rendering


Using nohup

nohup is a simple shell command that tells the program it's told to run not to exit when you log out. It's great for leaving long running processes in the background without having to keep a shell open--i.e. keeping them running in case you need to or accidentally log out (or if the windows computer on which you've logged in freezes and needs to be restarted.)

example:
nohup Render Foo.mb &
or, more politely put:
nice nohup Render Foo.mb &

Again, pretty simple. the '&' tells the shell to not only nohup the command, but to also run it in the background, letting you continue on with whatever else you want to do. It will probably say something like Sending output to nohup.out. By default, nohup spits all of its output (both stdout and stderr) into a file called nohup.out, which can be very useful for examining in case something doesn't work correctly with your job. nice tells the operating system to give the command a lower scheduling priority, which is very "nice" to other users of the computer (but won't make it slower if no on is using the computer)


Simple batch rendering

A simple example of batch rendering uses two of the commandline options to Render, see if you can follow:

ssh -f cream nice nohup Render -s 1 -e 10 Foo.mb &
(enter password)
ssh -f oil nice nohup Render -s 11 -e 20 Foo.mb &
(enter password)
ssh -f milk nice nohup Render -s 21 -e 30 Foo.mb &
(enter password)

the -f option to ssh tells ssh that you're not really wanting to log in to do any more than run the given command at each of the destinations (i.e. cream, oil, milk). If you are already using ssh-agent, this is the same as the -n option, and you won't be asked for your password.


Advanced command-line rendering

sleep, and other methods to defer rendering to a certain time

using the commands such as sleep,at, or by starting and editing a crontab file on one of the linux macchines, you can specify to start the rendering at a later point in time (like, if you've finished one project, but don't want to start rendering while you're working on the next project, or if you don't want to start rendering while other people are using the computer because you're a polite student).

example:
sleep 2h 30m; ssh -f milk nice nohup Render -s 21 -e 30 Foo.mb &

using ssh-agent to make life easier

using ssh-agent and your own personal ssh private/public DSA key pair, you can ssh from machine to machine without having to enter a password. This is great for writing scripts to automatically farm out your rendering jobs, or for using the preceding sleep example.

example: a quick (not to thorough) how-to:
cream[~]13:01:32$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/finney/.ssh/id_dsa): (enter)
Enter passphrase (empty for no passphrase): (enter a passphrase)
Enter same passphrase again: (enter it again)
Your identification has been saved in /home/finney/.ssh/id_dsa.
Your public key has been saved in /home/finney/.ssh/id_dsa.pub.
The key fingerprint is:
aa:0d:e0:83:ef:2e:21:fd:ba:62:d6:a4:8c:99:13:5a finney@cream.cs.swarthmore.edu

next, copy your id_dsa.pub file to a file called /home/yourusername/.ssh/authorized_keys2.

next, put this in your /home/yourusername/.xsession, just before the line that calls your windowmanager:

eval `ssh-agent`
ssh-add .ssh/id_dsa <dev/null

the next time you login to your favorite machine, you'll be prompted by a little program that asks you for your passphrase. enter it, and then ssh happily and password-free for the rest of your session. (note: you can also enter those two commands on the command line, if you're logged in remotely)


Truly 1337 rendering

Alas, I am not 1337 enough to say I could tell you how to be a grand master and command line rendering. I have, however, ganked all of the command line options that you can pass to Render, and put them in a file, here.

(happy rendering)