0
$\begingroup$

I cannot render a animation with CUDA. This is my script and the commandline order:

import bpy

bpy.context.user_preferences.addons['cycles'].preferences.compute_device_type = 'CUDA' bpy.context.user_preferences.addons['cycles'].preferences.devices[1].use = False bpy.context.scene.cycles.device = 'GPU'
bpy.context.scene.render.tile_x = 256 bpy.context.scene.render.tile_y = 256
bpy.ops.render.render(write_still=True)

This is the command:

blender -b mainfile.blend -E CYCLES -t -a //file -P script.py

Sometimes says "error there is no //file " and sometimes begin the render but using the cpu..

HELP

$\endgroup$

1 Answer 1

1
$\begingroup$

The -t option is to specify how many threads are used for rendering, this should be followed by a number but the -a you have following it will give you an error.

The main issue you have with your command is that blender executes the arguments in the order they are given. Following it through means that blender starts in background mode, loads mainfile.blend, sets the engine to cycles, incorrectly sets the threads, renders an animation, opens the file //file then runs the script script.py.

What should work for you is -

blender -b mainfile.blend -E CYCLES -P script.py

If you are adding //file to specify the output file for the render, then you need to put -o in front of it (and add a file extension) and if it is a folder then also add a trailing slash -o //test_renders/.

You may also want to remove the render line from your script and use -f <frame number>. Note that using -f to render a specific frame from the command line will save the image to file so you don't need the render step in your script.

blender -b mainfile.blend -E CYCLES -P script.py -o //file.jpg -f 1
$\endgroup$
2
  • $\begingroup$ Thanks sambler its work ´s!!!!!! for an animation i should put -a ? and for a part of the animation ? thanks !!! $\endgroup$
    – ezearebalo
    Sep 4, 2017 at 4:04
  • $\begingroup$ You can find all the options in blenders manual or with blender --help -- -a renders the entire animation. -f 2 will render just frame 2. -s 10 -e 15 will render frames 10 to 15 of an animation. -j 5 will only render every fifth frame in an animation. $\endgroup$
    – sambler
    Sep 4, 2017 at 9:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .