Blender file cloud GPU rendering

This article introduces a technical guide on how to render Blender animations on the GPU cloud platform vast.ai. It is assumed that you have used vast.ai and know how to start an instance. The important step here is to select the correct image for the instance.

insert image description here

Recommendation: Use NSDT editor to quickly build programmable 3D scenes

Use nvidia/cuda:11.4.1-cudnn8-devel-ubuntu20.04 image. It is possible to replace Ubuntu 20.04 with another distribution, but requires cuda:11.4.1 or higher instead of the base image. The base image does not include nvcc which is required by Blender. cuda versions prior to 11.4.1 do not include support for the RTX 3090.

Once the instance is running and connected to the instance, the following packages need to be installed:

$ apt-get install -y vim netcat curl libglu1-mesa-dev libxi6 libxrender1 libfontconfig1 libxxf86vm-dev libxfixes-dev libgl1-mesa-glx

Download and unzip Blender:

$ curl -OL https://ftp.halifax.rwth-aachen.de/blender/release/Blender2.93/blender-2.93.4-linux-x64.tar.xz && unxz blender-2.93.4-linux-x64.tar.xz && tar -xvf blender-2.93.4-linux-x64.tar

Create 2 folders: media and output. We'll use media to store Blender files, and output to store rendered files:

$ cd blender-2.93.4-linux-x64 && mkdir media output

Create a new file gpu.py with the following content:

import bpy
scene = bpy.context.scene
scene.cycles.device = 'GPU'
prefs = bpy.context.preferences
prefs.addons['cycles'].preferences.get_devices()
cprefs = prefs.addons['cycles'].preferences
cprefs.compute_device_type = 'CUDA'
for device in cprefs.devices:
    if device.type == 'CUDA':
        device.use = True

This file tells Blender to use only CUDA and GPU for rendering.

Transfer the Blender files to the media folder. You can use scp, netcat, or download from the web.

Start rendering:

$ cd blender-2.93.4-linux-x64
$ ./blender -b media/animation.blend  -P gpu.py -o output/ -a

You will find the rendered files in the output folder. It can be downloaded via scp.


Original Link: Blender Cloud GPU Rendering—BimAnt

Guess you like

Origin blog.csdn.net/shebao3333/article/details/132471808