Skip to content

Run Blender on Google Colab

microSingularity edited this page Dec 8, 2021 · 3 revisions

This is the official code repository for the tutorials of microSingularity

https://www.youtube.com/c/MicroSingularity/

There are multiple tutorials on this channel which use this or similar code. All Google Colab Blender tutorials can be found here: https://www.youtube.com/playlist?list=PLV0Zsi5ZYUasqIKTYo7et4iJuaSIArSy5

https://youtu.be/eOxawEi5cNk https://youtu.be/lEW7efy_aiY

Instructions for use

Upload your Blender Scene to Google Drive

First login to your google drive and create a folder to store your blender scene. In my example, I have created a folder in my Google Drive called Blender_Files (make sure there are no spaces in the file names or folders) and put a blender file called blender_scene.blend in that folder.

Download my Code Notebook from GitHub

Go to https://github.com/microSingularity/blenderGoogleGPU and click the green code button in the top right corner of the window and press "download zip". Save this zip file to your local PC somewhere and unzip the file.

On windows, you right click on the file and select "Extract All"

Open your web browser and go to Google Colaboratory at www.colab.research.google.com. Go to file, open notebook. Go to the "Upload" tab and press "Choose File". Upload the "BlenderColab.ipynb" file from the unzipped folder on your computer. Wait a few momenets for the notebook to load. Once loaded, go to the edit menu and select "Notebook Settings".

Make sure Hardware accelerator is set to "GPU" and make sure "Omit code cell output when saving this notebook" is checked. Press Save.

Go to the top right corner of the window and press "Connect". If the session has connected with a GPU, it will say "Connected to Python 3 Google Compute Engine Backend (GPU)".

Connect your Google Drive Account to Google Colab

Run the next cell by pressing the play button and follow the prompts to approve Google Colab's connection to your google drive. This may require you to type a code to approve the connection.

If your Google Drive has been connected successfully, it will say "Mounted at /content/drive".

To see the files in your Google Drive from Colab, move your cursor over to the left side of the screen and click the folder icon, Then expand the drive/MyDrive folder to see all your files.

Download Blender to Google Colab

Run the next section of code. By default, the script will download Blender 2.93 from the Blender website. You can change this by going to the blender releases website and selecting a different version of Blender. In this example, I have gone to the Blender 3.0 release folder. Right click on the Blender3.0.0 linux tar.xz file and click "copy link".

Paste this link in the section of code where it says "!wget .....". This will download the specific version of Blender you have chosen.

Press the play button for this code cell and it will download Blender. Wait a few minutes for this to complete.

Unzip Blender

Go to the file explorer on the right side