Rendering Blender3D & AnimationNodes scenes with frof

Blender3D is great software, and Animation Nodes (AN) makes it even better, but unfortunately enabling Animation Nodes means that you can’t always render an animation from the Blender GUI. And — more relevantly — Animation Nodes are each individually single-threaded, which means that even if you can render on a GPU or a ton of CPUs, you’re still bottlenecked by the amount of time it takes to compute AN for each frame on a single core.

To get around this, I wanted to accomplish two things:

  • Render a Blender animation from the command-line with animation-nodes enabled in a Docker container
  • Parallelize rendering of frames across CPUs on a machine

Spoiler:

image

Process

I use a framework for this sort of multiplexing already, called frof. Frof gobbles up a simple config file in .frof format (you’ll intuit this syntax in a few seconds).

For this render job, I used the following render.frof file to render a 1000-frame animation:

# Render groups of frames, 16 at a time (16 CPUs). Use the parameter `f`,
# which is defined on the last line of the file:
render(&f, 16) -> done

# `blender-an` is an alias to a Docker run command:
render:  blender-an -b ~/AN-render/animation-nodes-frof.blend -s 0 -e 9 -t 1 -a
done:    echo "done"

# Param-sweep the `f` param from 0 to 99:
&f: list(range(0, 99))

I also used a Docker image with animation-nodes already installed: My Dockerfile is available here. I’ve aliased this to blender-an with alias blender-an="docker run --rm -t blender-an dockerfiles/blender-an-rendernode".

I ran this by pip-installing frof:

pip3 install -U git+https://github.com/j6k4m8/frof

And then running with the following command:

frof render.frof --status http

This will serve a frof status monitor on http://localhost:8111 that shows you realtime status updates and a progress bar.

You can also use --status oneline wich will print the following line to your terminal (and keep it updated in realtime):

██▒░░░░░░░░░░ 🤔 18% done (176 of 1000 jobs complete)
Written on March 31, 2020
Comments? Let's chat on mastodon (Or on Twitter if you absolutely must...)