Hi.

Welcome to my blog. I document my adventures in travel, style, and food. Hope you have a nice stay!

Modo Rendering From The Command Line

Modo Rendering From The Command Line

Rendering from the command line can be a scary proposition for many artists, after all, why render with arcane commands when one can simply press a button and be done with it?

But rendering in headless mode, as modo calls it, has a number of advantages:

  • It saves RAM and thereby potentially speeds up your rendering, because it doesn't have to load the whole modo UI and all that entails.
  • It allows rendering on a render farm either in the cloud or on your local machine/network.
  • It is more flexible in how you tackle a rendering.
  • It tends to run more stable as—related to the first point—you don't add the whole application to the render process minimizing memory leaks and other bugs.

These advantages are not limited to modo mind you. All DCC apps benefit from it. Maya and Cinema4D as well as Nuke or After Effects. However, in this article I want to focus on how to make headless rendering with modo more painless.

The Render Command(s)

Unfortunately, the standard modo docs are not of much help in figuring out how to get started with command line rendering. They do not even mention it. For that you need to consult the modo SDK docs.

Scary amount of text, right? Sounds like programming and all you want to do is render pretty pictures.

Sadly, modo’s command line rendering is not as straight forward as other solutions where a simple one-liner is sufficient. On the flip side modo’s approach allows for much more then simply rendering.

But don’t despair, it really is rather simple and can be condensed into a few simple paragraphs. When we are done you will have a text file that looks something like this:

log.toConsole true
log.toConsoleRolling true
scene.open "r:\NetRender\modo\Content\Food\CoffeeBeans.lxo"
pref.value render.threads auto
select.Item Render
item.channel step 1
item.channel first 1
item.channel last 150
item.channel outPat "_<FFFF>"
render.res 0 1920
render.res 1 1080
render.animation {*}
app.quit

Breaking it down

Let’s go through it line by line.

log.toConsole true
log.toConsoleRolling true

These two lines tell modo to output what I would call standard progress output. It’ll tell you which frame modo renders, how long it has been rendering said frame and a bunch of other valuable information about the rendering progress.

scene.open "r:\NetRender\modo\Content\Food\CoffeeBeans.lxo"

With logging turned on we tell modo which scene we want to open. We could load the scene first, but having logging enabled at this stage helps to spot potential problems like textures that aren’t loading.

pref.value render.threads auto

You want to use as many threads as possible for your renders. This turns them all on. It should be on by default, but better safe then sorry, right?

select.Item Render
item.channel step 1
item.channel first 1
item.channel last 150

This next block sets up your render range. You tell modo to select the Render item and set the first and last frame as well as the frame stepping.

item.channel outPat "_<FFFF>"

Here we adjust the output pattern.

render.res 0 1920
render.res 1 1080

And last, but not least this allows us to adjust the output resolution.

Strictly speaking you do not need the last three blocks of code as modo will pick up whatever is set in the scene. But this allows you to specify an arbitrary range and frame stepping, which is useful if you want to split up your shot across several machines for example.

render.animation {*}

This finally is the actual render command. It will render the frame range from beginning to end and save the images to wherever the render outputs are set to.

If you have render passes you might want to try render.animation {*} group:passes (where passes is the name of the pass group you want to render).

app.quit

This last command exits modo after rendering has completed. Simple as that.

See? It’s not that complicated. All you do is write those ten lines into a text file and pass it on to modo_cl (modo’s command line version).

That passing on looks like this:

<Path to modo_cl> < <Path to Textfile>

or on my system:

/Applications/modo.app/Contents/MacOS/modo_cl < /Users/alex/testrender.txt

This text file → modo_cl approach gives you the basic functionality. From now on you can happily render from the command line simply by adjusting your text file with the new scene and frame ranges and off you go.

Scripting Headless Render

But wait, there’s more! modo_cl is much more then a simple command line render. It is the full modo program minus the UI. And with your text file you are actually executing full modo commands the same way as if you clicked around in modo. Understanding this opens up the door to an almost unlimited number of possibilities.

You could for example:

  • Change the render output path before rendering.
  • Turn scene items on or off without having to save different versions of a scene before rendering (for example to render different pass groups).
  • Have a script that creates a completely new scene based on a spreadsheet or some other external parameters from scratch and renders it without ever saving anything to disk.

Almost any command you search will be revealed to you by pressing F5 in modo and looking at the History tab for the last command you executed. Just copy the command and adjust for your needs.

If you put your mind to it, I am sure you can come up with even better examples that would benefit your workflow.

Almost Fire And Forget Rendering

If you think that all this is fine and good, but all you really want is to push a button and start rendering I also have an option for you.

Adam O’Hern’s excellent Render Monkey, which does not do command line rendering, but otherwise is an excellent batch rendering tool that should be in every modo users’ tool bag.

And if there is interest I'll go through the headless rendering script I use for our own production workflow in one of my next arcticles. As always feel free to share any feedback on Twitter or the modo forums.

Interview with Commercial Artist, Warner McGee

Interview with Commercial Artist, Warner McGee

MODO | Making a Waffle with Mesh Fusion

MODO | Making a Waffle with Mesh Fusion

0