LoginSignup
1
0

More than 3 years have passed since last update.

Blender Render Farm on Azure Kubernetes Service 実現に向けて

Last updated at Posted at 2020-09-22

こんにちは、Japan Azure User Group 10周年記念イベントでお話させいただく予定の内容の補足です。

Blender Render Farm on Azure Kubernetes Service 実現に向けて

Blender 2.7系だとレンダーファームを作るアドオンは用意されているみたい。

Docker Blender Render Cluster
- DockerベースのBlenderレンダークラスター
- https://github.com/rndevfx/docker-blender-render-cluster
Kubernetes上にBlenderのレンダリングファームを作る(@inajobさんのQiita記事)
- https://qiita.com/inajob/items/bc43cb3f6506815870a2

Crowdrender
- https://www.crowd-render.com/

Blender 2.8/2.9だとレンダーファームを作るアドオンが見つからないので作るしかないもよう。せっかく作るんだったら、Blenderのファイルが読めてレンダリングできる範囲でのバージョン差でレンダリングできるようにしたい。あと、レンダリング中にMasterと接続できなくなったり、MasterとSlaveが接続できなくなったりするのは困るので、疎結合な感じで考えたい。

時間があるときに作るために、メモを書き記しておこうと思う。

Workerコンテナ。Ubuntu 20.10のapt-getからインストールの場合。

dockerfile
FROM ubuntu:20.10
RUN apt-get update
RUN apt-get install -y blender xvfb

Workerコンテナ。最新版本家からインストールの場合。

dockerfile
FROM ubuntu:20.10
RUN apt-get update
RUN apt-get install -y wget xz-utils tar gzip libx11-6 libxi6 libxxf86vm1 libxfixes3 libxrender1 libgl1 xvfb
RUN wget https://ftp.nluug.nl/pub/graphics/blender/release/Blender2.90/blender-2.90.0-linux64.tar.xz
RUN tar Jxvf blender-2.90.0-linux64.tar.xz

Workerコンテナでレンダリングする場合のGPU設定。
参考:https://devtalk.blender.org/t/blender-2-8-unable-to-open-a-display-by-the-rendering-on-the-background-cycles/8607/18

setgpu.py
import re
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
print(cprefs)
# Attempt to set GPU device types if available
for compute_device_type in ('CUDA', 'OPENCL', 'NONE'):
    try:
        cprefs.compute_device_type = compute_device_type
        print('Device found',compute_device_type)
        break
    except TypeError:
         pass
# Enable all CPU and GPU devices
for device in cprefs.devices:
    if not re.match('intel', device.name, re.I):
        print('Activating',device)
        device.use = True
    else:
        device.use = True

Workerコンテナでレンダリング実行

Xvfb :1 -screen 0 1920x1080x24 &
export DISPLAY=:1
blender -b <blenderファイル> -P setgpu.py -o <画像ファイル名> -f <レンダリング対象フレーム>

さいごに

じゃずにゃんは次の記事にします。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0