diff options
author | Andrii <pembem22> | 2021-11-11 10:57:35 +0300 |
---|---|---|
committer | William Leeson <william@blender.org> | 2021-11-11 11:39:25 +0300 |
commit | c63e735f6b601e662fbb1ed5d7a71293552d6720 (patch) | |
tree | 83e7eb2e002067fc7072a63fd3badca9a471f5d8 /intern/cycles/blender/sync.cpp | |
parent | b8d53b703a4e20b4301e794bf58c9d1fdb65d61b (diff) |
Cycles: Add sample offset option
This patch exposes the sampling offset option to Blender. It is located in the "Sampling > Advanced" panel.
For example, this can be useful to parallelize rendering and distribute different chunks of samples for each computer to render.
---
I also had to add this option to `RenderWork` and `RenderScheduler` classes so that the sample count in the status string can be calculated correctly.
Reviewed By: leesonw
Differential Revision: https://developer.blender.org/D13086
Diffstat (limited to 'intern/cycles/blender/sync.cpp')
-rw-r--r-- | intern/cycles/blender/sync.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/intern/cycles/blender/sync.cpp b/intern/cycles/blender/sync.cpp index 92662e37bc2..59d684dcf05 100644 --- a/intern/cycles/blender/sync.cpp +++ b/intern/cycles/blender/sync.cpp @@ -835,18 +835,25 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine &b_engine, /* samples */ int samples = get_int(cscene, "samples"); int preview_samples = get_int(cscene, "preview_samples"); + int sample_offset = get_int(cscene, "sample_offset"); if (background) { params.samples = samples; + params.sample_offset = sample_offset; } else { params.samples = preview_samples; - if (params.samples == 0) + if (params.samples == 0) { params.samples = INT_MAX; + } + params.sample_offset = 0; } + /* Clamp sample offset. */ + params.sample_offset = clamp(params.sample_offset, 0, Integrator::MAX_SAMPLES); + /* Clamp samples. */ - params.samples = min(params.samples, Integrator::MAX_SAMPLES); + params.samples = clamp(params.samples, 0, Integrator::MAX_SAMPLES - params.sample_offset); /* Viewport Performance */ params.pixel_size = b_engine.get_preview_pixel_size(b_scene); |