diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-03-30 16:55:12 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-03-30 17:02:27 +0300 |
commit | f8b9f4e9bbc10675de9bbc3088f2841381e23f78 (patch) | |
tree | b03a144fc66280350a72fc856c69ff59dfc763bb /intern/cycles/blender/addon/engine.py | |
parent | ee364b63582c606977cc7dc54435d02fb9e1981c (diff) |
Cycles: Resumable render implementation for Cycles
This feature is also known by the name Samples Offset, which allows
artists to render animation with given amount of samples N, but then
render more samples, starting from N and ending with M (where M > N)
and merge renders together as if they rendered exactly M samples.
Surely such effect could be achieved by changing Seed variable, but
that has possible issues with correlation artifacts and requiring to
manually deal with per render layer samples and such.
While we can't support all possible renderfarm-related features in
Cycles it's nice to support really commonly used stuff.
Here's a command how to run Blender with the new feature enabled:
blender -- --cycles-resumable-num-chunks 24 --cycles-resumable-current-chunk 2
This command will divide samples range in 24 parts and render
range #2 (chunk number is 1-based).
This feature might be changed a bit after we'll do some tests here
in the studio with it.
Diffstat (limited to 'intern/cycles/blender/addon/engine.py')
-rw-r--r-- | intern/cycles/blender/addon/engine.py | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/intern/cycles/blender/addon/engine.py b/intern/cycles/blender/addon/engine.py index 96dc3a59ef2..d4b7535b9ee 100644 --- a/intern/cycles/blender/addon/engine.py +++ b/intern/cycles/blender/addon/engine.py @@ -50,10 +50,39 @@ def _workaround_buggy_drivers(): _cycles.opencl_disable() +def _parse_command_line(): + import sys + + argv = sys.argv + if "--" not in argv: + return + + argv = argv[argv.index("--") + 1:] + + num_resumable_chunks = None + current_resumable_chunk = None + + # TODO(sergey): Add some nice error ptins if argument is not used properly. + idx = 0 + while idx < len(argv) - 1: + arg = argv[idx] + if arg == '--cycles-resumable-num-chunks': + num_resumable_chunks = int(argv[idx + 1]) + elif arg == '--cycles-resumable-current-chunk': + current_resumable_chunk = int(argv[idx + 1]) + idx += 1 + + if num_resumable_chunks is not None and current_resumable_chunk is not None: + import _cycles + _cycles.set_resumable_chunks(num_resumable_chunks, + current_resumable_chunk) + + def init(): import bpy import _cycles import os.path + import sys # Workaround possibly buggy legacy drivers which crashes on the OpenCL # device enumeration. @@ -72,7 +101,7 @@ def init(): user_path = os.path.dirname(os.path.abspath(bpy.utils.user_resource('CONFIG', ''))) _cycles.init(path, user_path, bpy.app.background) - + _parse_command_line() def exit(): import _cycles |