Skip to content

Instantly share code, notes, and snippets.

@charly-vega
Forked from Mikulas/config.py
Created April 28, 2018 19:44
Show Gist options
  • Save charly-vega/fb92c3e957209d0f1b99dda86992cb07 to your computer and use it in GitHub Desktop.
Save charly-vega/fb92c3e957209d0f1b99dda86992cb07 to your computer and use it in GitHub Desktop.
import bpy
# https://blender.stackexchange.com/questions/5281/blender-sets-compute-device-cuda-but-doesnt-use-it-for-actual-render-on-ec2
bpy.context.user_preferences.addons['cycles'].preferences.compute_device_type = 'CUDA'
bpy.context.user_preferences.addons['cycles'].preferences.devices[0].use = True
bpy.context.scene.cycles.device = 'GPU'
bpy.data.scenes["Scene"].render.filepath = "/tmp/output.png"
bpy.ops.render.render(write_still=True)
BLEND="/tmp/foo.blend"
/home/ec2-user/blender --background "$BLEND" \
--use-extension 1 \
-noaudio -nojoystick \
-E CYCLES -t 0 \
-P "config.py"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment