Saturday, December 12, 2009

Batch Render in renderView

Have you ever run into a Maya scene that renders fine in the render view window, but absolutely refuses to batch render correctly? One would think they would produce the same results, but I've had a lot of scenes which would render perfectly fine as a single frame, and then go horribly wrong when I tried to batch render.

Luckily, it's simple to write a MEL script that sets up a pseudo-batch render in the render view. Before you do this, a few warnings:

1. Make sure you save your file before you execute this render!
2. Once you start this render, you won't be able to stop it, so double check and make sure all your render settings are correct before executing.
3. Make sure you get the start and end frame numbers correct, because, once again, when this render starts you can't stop it.
4. The rendered images will appear in your current project's images/tmp directory. I recommend deleting everything else in the tmp directory before starting to make it easy to find the images.
5. SAVE YOUR FILE

Here's the script. Suppose, for example, you want to do a render view batch render for frames 101 through 200:

int $i;
for ($i = 101; $i <= 200; $i++){
currentTime $i;
RenderIntoNewWindow;
}

Easy, huh? As mentioned, the images will appear in the image/tmp directory of your current project. Oh, and you won't be able to stop it. Even if you push Esc to end the render, the script will execute the next frame. Thus, in the example above, the only way to get back to Maya is to push Esc 100 times! Or quit Maya. Hopefully you saved your file beforehand. Good luck with your renderings, hope this little script helps you out--it's certainly saved me on many occasions.