From a4d933e93e6a9fa895ea144350b223e59a75f48e Mon Sep 17 00:00:00 2001 From: Lukas Stockner Date: Wed, 5 Jun 2024 23:14:15 +0200 Subject: [PATCH] Cycles: Clamp sample number during viewport navigation to max samples Previously, Cycles would render up to 4SPP during viewport navigation when using reduced resolution, even when the overall number of samples was set lower. This causes problems with the blue-noise pattern, so ensure that the number of samples is always clamped to the configured maximum. --- intern/cycles/integrator/render_scheduler.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/intern/cycles/integrator/render_scheduler.cpp b/intern/cycles/integrator/render_scheduler.cpp index 53faf6db091..ec5c1d63789 100644 --- a/intern/cycles/integrator/render_scheduler.cpp +++ b/intern/cycles/integrator/render_scheduler.cpp @@ -946,12 +946,14 @@ int RenderScheduler::get_num_samples_during_navigation(int resolution_divider) c return 1; } - /* Schedule samples equal to the resolution divider up to a maximum of 4. + /* Schedule samples equal to the resolution divider up to a maximum of 4, limited by the maximum + * number of samples overall. * The idea is to have enough information on the screen by increasing the sample count as the * resolution is decreased. */ + const int max_navigation_samples = min(num_samples_, 4); /* NOTE: Changing this formula will change the formula in * `RenderScheduler::calculate_resolution_divider_for_time()`. */ - return min(max(1, resolution_divider / pixel_size_), 4); + return min(max(1, resolution_divider / pixel_size_), max_navigation_samples); } bool RenderScheduler::work_need_adaptive_filter() const