diff options
author | Patrick Mours <pmours@nvidia.com> | 2020-02-25 15:31:08 +0300 |
---|---|---|
committer | Patrick Mours <pmours@nvidia.com> | 2020-02-25 17:27:11 +0300 |
commit | 0c09700f20646bb4083063bfe525e05d52e79b10 (patch) | |
tree | 116bf608ce95b8cff7177cd89d43731f5d7e4a12 /intern/cycles/render/session.cpp | |
parent | a4a1074f3d2411a562c5cd4d5ebee6d92a1f0a27 (diff) |
Cycles: Add option to change which sample to start viewport denoising at
This patch adds a new user-configurable option to change at which sample viewport
denoising should kick in. Setting it to zero retains previous behavior (start immediately), while
other values will defer denoising until the particular sample has been reached. Default is now
at one, to avoid the weirdness that is AI denoising at small resolutions.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D6906
Diffstat (limited to 'intern/cycles/render/session.cpp')
-rw-r--r-- | intern/cycles/render/session.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp index acf9ca68889..ae0a2cf863a 100644 --- a/intern/cycles/render/session.cpp +++ b/intern/cycles/render/session.cpp @@ -908,9 +908,6 @@ void Session::set_samples(int samples) params.samples = samples; tile_manager.set_samples(samples); - { - thread_scoped_lock pause_lock(pause_mutex); - } pause_cond.notify_all(); } } @@ -946,6 +943,15 @@ void Session::set_denoising(bool denoising, bool optix_denoising) tile_manager.schedule_denoising = denoising && !buffers; } +void Session::set_denoising_start_sample(int sample) +{ + if (sample != params.denoising_start_sample) { + params.denoising_start_sample = sample; + + pause_cond.notify_all(); + } +} + void Session::wait() { if (session_thread) { @@ -1110,8 +1116,8 @@ void Session::denoise() return; } - /* It can happen that denoising was already enabled, but the scene still needs an update. */ - if (scene->film->need_update || !scene->film->denoising_data_offset) { + /* Do not denoise viewport until the sample at which denoising should start is reached. */ + if (!params.background && tile_manager.state.sample < params.denoising_start_sample) { return; } @@ -1122,6 +1128,11 @@ void Session::denoise() return; } + /* It can happen that denoising was already enabled, but the scene still needs an update. */ + if (scene->film->need_update || !scene->film->denoising_data_offset) { + return; + } + /* Add separate denoising task. */ DeviceTask task(DeviceTask::DENOISE); |