Render Blender Projects on the google cloud using Sheepit


Intro

So you finally finished the blender scene you've been working on, but it got so complex, even rendering a low-quality preview takes too long on your PC?
(If your PC can easily handle rendering and other stuff at the same time or is dedicated to rendering, this tutorial is not for you)

Look at my awesome preview, it took just 75 minutes to render!
  - Someone rendering on a potato


In that case, you should consider rendering your project on the Google cloud platform.

What is "Google cloud"

Google Cloud Platform[1] is a set of cloud computing services offered by Google. It includes a range of hosted services for compute, storage and application development that run on Google's hardware. For our purposes, we're only interested in the Google Compute Engine (GCE). I'm going to call it "Compute".

Compute allows us to create virtual machines ("VMs") with a customizable amount of RAM and cores running on Google's hardware. Compute Engine is a pay-per-usage service and maybe not optimal regarding pricing on a long run, but they offer a free trial that includes $300 on any Google Cloud product (and a 60-day limit) wich should totally suffice to get your project done.

Important to know is that either a credit card, debit card, or bank account is required to get registered with Google Cloud!


What is "Sheep It"?

As the website says, SheepIt[1:1] is a free distributed renderfarm for Blender.

But what is a render farm?

A render farm is a computer system, e.g. a computer cluster, built to render images and animations faster by splitting the workload between the connected devices. If every machine in the network renders one image of an animation, it'll obviously be done way faster than with a single machine.

But SheepIt is not only the platform that manages projects and their distribution, but it's also an awesome community of people who help each other render their projects. That's how they stay completely free, the community renders their projects. I highly encourage you to keep your VM(s) running, rendering other projects, if you happen to have credits left after finishing your project. Doing that will also get you quite some points for later on when you might need to render something large again.

What are points?
To quote their FAQ

Points are used to order the list of projects. The more points you have, the higher priority your project will have.
You will earn points by sharing your computer to help render. But you will lose some when someone renders one of your frames.

https://www.sheepit-renderfarm.com/faq.php


Setting up the VMs

At this point, you should have registered a Google cloud account and selected Compute from the menu on the right.

This is what you should see, except for the running instances I already set up prior to writing this there should be a dialog asking you to either create a new instance or go through a quick tutorial.

Compute start screen

The next thing to do is create a new instance.
I'll go through the right settings step by step.
The first thing you'll probably notice is the cost per month that is on the right. This might look a bit scary when it goes up to $100 plus but as Google themselves mentioned a couple of times during signup and the tutorial no actual costs or fees can come up unless you manually upgrade your Google cloud account to a paid account. So don't worry about going crazy with the settings, the only thing that can happen is running out of free credits

The name

I named my new VM tutorial-instance but this is up to you.

The machine type

This is one of the important steps. Because these VMs don't have a powerful GPU, we really need to get the most out of the CPU cores. Thus we set them to the maximum of 8 cores for free account (Upgraded account can select up to 32 cores)
Select the last option from the drop-down menu
*8 vCPUs 7.2GB memory, n1-highcpu-8

You can click customise to set cores and memory manually, but after running and monitoring them while they rendered more memory didn't seem necessary to me.

The boot disk

Leave the boot disk at the pre-selected "Debian GNU/Linux 8 (jessie)". There's not a lot of interaction with the OS after everything has been set up once. The disk size of 10GB is also more than enough.

Identity and API access

Can stay as it is

Firewall

Here we need to check 'Enable HTTP traffic.'

That's it. Your new instance should now show up in your list of instances. After a little while, a small circle with a checkmark will appear and you can click on 'ssh' on the right

SSH key on the right


Setting up the SheepIT client

Now you should go ahead and register an account at sheepit[1:2] if you haven't done that already. Create a new project and upload your files but read their FAQ first because some things like fluid physics require certain preparations. By default SheepIt is set up to render your own projects first.
Sign in and head to the 'Get started' section, scroll down to the 'Tiny FAQ' and expand the 'Can I launch the client without a web browser?' section. Right click the jar file link and copy its address.

Now switch to the SSH window you opened previously (The console)
ssh window 1
Enter 'wget' hit space and paste the link you copied earlier. The jar file will now be downloaded to the VM into the root folder.
Type 'ls' and hit enter to confirm that the file exists.

minzkraut@tutorial-instance:~$ wget https://www.sheepit-renderfarm.com/media/applet/sheepit-client-5.292.2728.ja
r
--2017-01-06 19:05:27--  https://www.sheepit-renderfarm.com/media/applet/sheepit-client-5.292.2728.jar
Resolving www.sheepit-renderfarm.com (www.sheepit-renderfarm.com)... 188.165.217.72, 2001:41d0:2:a448::1
Connecting to www.sheepit-renderfarm.com (www.sheepit-renderfarm.com)|188.165.217.72|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1966815 (1.9M) [application/java-archive]
Saving to: ‘sheepit-client-5.292.2728.jar’
sheepit-client-5.292.2728.j 100%[=============================================>]   1.88M  2.87MB/s   in 0.7s   
2017-01-06 19:05:28 (2.87 MB/s) - ‘sheepit-client-5.292.2728.jar’ saved [1966815/1966815]
minzkraut@tutorial-instance:~$ ls
sheepit-client-5.292.2728.jar
minzkraut@tutorial-instance:~$ 

Now rename the file to 'sheepit-client.jar' by executing this command:
`mv sheepit-client-x.xxx.x.jar sheepit.jar``
Replace the X's with whatever version number you got but usually typing 'she' followed by Tab should autocomplete the filename.

Running the client requires the Java runtime which we can install with the following command
apt-get install default-jre confirm everything with 'Y Enter ' and wait for the installation to finish. It should only take about a minute.

Now we have everything we need to start rendering, but for convenience sake we're going to make a tiny script that starts the process. Open up an editor by typing 'nano start.sh' and hit enter. Copy this snippet and paste it into the SSH window

#!/usr/bin/env bash
java -jar sheepit.jar -login MYLOGIN -password MYPASSWORD

Replace the credentials with your sheepit login and hit Ctrl+O make sure the filename is 'start.sh' and hit enter
Nano Editor
Ctrl+X closes the editor

Now mark the start script as an executable by entering 'chmod +x start.sh'

Awesome, we're almost good to go.


Rendering in a tmux session

The rendering process can be started with the command
'./start.sh' (the dot and the slash are important) BUT it would be stopped as soon as we'd leave the SSH session. To keep it running in the background, we need a tool called tmux. We can install it just like we did with the Java runtime, run this command:
'sudo apt-get install tmux'

Run tmux with command 'tmux'! You now should see a green bar at the bottom. At this point we can start rendering ('./start.sh' as mentioned) and leave the tmux session by hitting Ctrl+B and then D (for "detach"), it is now running in the backround. ('tmux a' will get you back into the session)

Close the terminal/SSH-Window


Duplicating the instance

Cool, we got out instance running and rendering but just one. We can do better. We could just repeat all the steps from above to spawn a new VM, but that's way too much work. Instead, we'll create a snapshot of the instance we got and duplicate it!

Click "Snapshots" in the Google cloud menu and hit "Create Snapshot" at the top. Select your previously created instance as the source disk and create the snapshot.

Making a snapshot

Now wait for the Snapshot to be created and open it, then hit "Create instance" in the upper right. Set the settings for this instance like you did before but make sure to select a zone that you haven't used before since a free account is limited to a certain number of cores per zone.

After the instance has been created, you can start rendering as before (Open the SSH connection, start tmux and render)

Now go ahead and get you projects done


Footnotes

  1. https://cloud.google.com

    ↩︎ ↩︎ ↩︎