Blender 2.83 on Oracle Cloud Infrastructure — Part 3

Jeff Davies
6 min readAug 6, 2020

If you haven’t already read Part 1 and Part 2, I strongly suggest you start there before reading this article.

In Part 2 you created a custom image with Blender installed on it, and then used that image to create a blender2 compute instance. In this article, I will show you how to render on the blender2 instance and then access the results of those renders.

To begin, we need to download a .blend file to our blender2 instance. As you learned how to do in Part 2, start an SSH session with your blender2 instance. Once you have established the SSH session, enter the following command:

curl -o classroom.zip \
https://download.blender.org/demo/test/classroom.zip

This will download the Classroom model, which is a good test of rendering power, to our blender2 instance. The classroom model contains multiple light sources and pretty good complexity.

Next we need to unzip the model. Execute the following command in your SSH instance:

unzip classroom.zip

The contents of the ZIP will can now be found in the ./classroom directory. Change into the ./classroom directory with the following command:

cd classroom

Now you can start the render process by entering the following command:

blender -b -P ~/rendersettings.py classroom.blend -o //classroom -f 1 -F PNG -noaudio

The render will take about 10 minutes and 22 seconds to complete. You will see the progress in your SSH terminal.

While it is rendering, lets take a closer look at the command line we used for the render. Some of this will be review from Part 2, but I like to be thorough.

Note: The order in which you supply arguments is the order in which Blender will process them.

The -b option starts Blender without any user interface. We don’t need a UI when we are rendering from the command line.

The -P ~/rendersettings.py option tells Blender to read in the rendersettings.py file from our home directory for additional configuration settings.

The classroom.blend is obviously the filename of the Blender model we want to render.

The -o //classroom option tells Blender to render the output to a file named classroom.

The -f 1 option tell Blender to only render frame 1. The classroom.blend file is also an animation of 140 frames total. We are only interested in the first frame.

The -F PNG option tells Blender to render this file as a PNG image.

Note: The case (upper vs lower) of the options makes a difference! As you can see -f and -F mean totally different things.

Finally, the -noaudio tells Blender not to try to initialize the audio card, because there is no audio card in the blender2 compute instance.

After about 10 minutes and 22 seconds (your time may vary, but not by more than a few seconds) Blender will have rendered the file.

Review the classroom0001.png File

The rendered image has the filename of classroom.png0001.png. Now we need to download it onto our local system so we can view it. We do that using a program called SCP (Secure CoPy). Open a new terminal or GitBash window so you don’t stop your existing SSH session.

Enter the following command (changing the IP address to match your blender2 machine’s IP) to download the .png file onto your local machine:

scp opc@150.136.50.250:classroom/classroom0001.png classroom.png

Open the file with an image viewer and check it out!

I wish I could model this well!

More Please! And Faster!

Well that was pretty good. But what if I want to render more images at the same time? You could start a second SSH session and issue another Blender command, but you’ll find that doesn’t really render any faster. Each of your two blender commands will now take twice as long to execute because they are sharing a single GPU. So there is no point in running 2 SSH sessions against a single instance.

So to scale things up you have 2 options. One is vertical scaling, where you use a bigger compute instance to do the work. If you created an instance (blender3) using the Bare Metal BM.GPU2.2 option (the one with 2 GPUs) you’ll find that the render time for that same command will be cut in half!

The second option is horizontal scaling. This is where you simply add more compute instances to work on the job. This works best for animation where you can divide up the scene into groups of images.

For example, lets imagine that we want to tell blender2 to render frames 1 through 6 and you’ve created a blender3 instance (using the BM.GPU2.2 shape to get 2 GPUs) and want it to render frames 7 through 19 (twice as many as the blender2 instance since blender3 will render twice as fast).

To tell Blender to render a range of frames you use the -s (start) and -e (end) options. The command to render frames 1 through 6 would now look like the following:

blender -b -P ~/rendersettings.py classroom.blend -o //classroom -s 1 -e 6 -F PNG -noaudio -a

Note: Don’t run that command unless you want to tie up blender2 for the next hour!

Notice that we have added the -a option at the end of the command. This tells Blender to render the frames of an animation from start to end, inclusive.

The Benchmarks

I didn’t take the time to do hundreds of renders to scientifically compare the render times. I also didn’t dig too deeply into optimizing Blender to render on this platform (yet). But here are my numbers:

Platform Render Time

  • VM.GPU2.1 — 10 minutes, 22 seconds
  • BM.GPU2.2 — 4 minutes, 24 seconds
  • My machine with a GeForce RTX 2080 Ti — 2 minutes, 41 seconds

Lets take a look at the total cost top render all 140 frames on these platforms.

  • VM.GPU2.1–10 minutes, 22 seconds for a total of 24 hours 11 minutes will have a cost of $31.88
  • BM.GPU2.2–4 minutes, 24 seconds for a total of 10 hours 16 minutes will have a total cost of $28.05
  • My Machine — 6 hours 41 minutes for no hard dollar cost, but my machine is tied up doing the render during that time. Fine for over night, not so good during the day when I want to be modeling!

So if you’re rendering for fun, you may well opt to stick with your current machine, especially if you have already invested in a beast of a graphics card. However, if you are running an animation studio, you could quickly spin up the equivalent of a dozen machines or more to do the renders without taking your artists offline, or having to purchase and manage a render farm yourself!

Conclusion

I hope you found this series of articles useful. As you can see, you don’t need to be a Fortune 500 company to make use of the cloud and see a significant savings. Even small and medium sized businesses are making use of Oracle Cloud Infrastructure to save time and money. There is also so much more that you can do with the Oracle Cloud that we haven’t even touched on. Things like Autonomous Database, High Performance Computing, machine learning and artificial intelligence, analytics and so much more! All of this capability, on demand, allows you to compete with the “big boys” at a fraction of the cost!

--

--

Jeff Davies

Long time software engineer, software architect, technical evangelist and motorcycle enthusiast.