Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Leeson <leesonw>2021-10-27 15:14:43 +0300
committerWilliam Leeson <william@blender.org>2021-10-27 15:21:15 +0300
commit82cf25dfbfad39a64b620c20bbd0d65915827a44 (patch)
tree33b2a3fe33da968cbc8a8172637177785c736fdc /intern/cycles/integrator
parent7b1c5712f888ea37bbccafd9ffd7a3a6a61e665f (diff)
Cycles: Scrambling distance for the PMJ sampler
Adds scrambling distance to the PMJ sampler. This is based on the work by Mathieu Menuet in D12318 who created the original implementation for the Sobol sampler. Reviewed By: brecht Maniphest Tasks: T92181 Differential Revision: https://developer.blender.org/D12854
Diffstat (limited to 'intern/cycles/integrator')
-rw-r--r--intern/cycles/integrator/tile.cpp36
1 files changed, 3 insertions, 33 deletions
diff --git a/intern/cycles/integrator/tile.cpp b/intern/cycles/integrator/tile.cpp
index b49e1b27b83..4a1558cce09 100644
--- a/intern/cycles/integrator/tile.cpp
+++ b/intern/cycles/integrator/tile.cpp
@@ -74,39 +74,9 @@ TileSize tile_calculate_best_size(const int2 &image_size,
TileSize tile_size;
const int num_path_states_per_sample = max_num_path_states / num_samples;
if (scrambling_distance < 0.9f) {
- /* Prefer large tiles for scrambling distance. */
- if (image_size.x * image_size.y <= num_path_states_per_sample) {
- tile_size.width = image_size.x;
- tile_size.height = image_size.y;
- }
- else {
- /* Pick the option with the biggest tile size */
- int heightOption = num_path_states_per_sample / image_size.x;
- int widthOption = num_path_states_per_sample / image_size.y;
- // Check if these options are possible
- if ((heightOption > 0) || (widthOption > 0)) {
- int area1 = image_size.x * heightOption;
- int area2 = widthOption * image_size.y;
- /* The option with the biggest pixel area */
- if (area1 >= area2) {
- tile_size.width = image_size.x;
- tile_size.height = heightOption;
- }
- else {
- tile_size.width = widthOption;
- tile_size.height = image_size.y;
- }
- }
- else { // Large tiles are not an option so use square tiles
- if (num_path_states_per_sample != 0) {
- tile_size.width = round_down_to_power_of_two(lround(sqrt(num_path_states_per_sample)));
- tile_size.height = tile_size.width;
- }
- else {
- tile_size.width = tile_size.height = 1;
- }
- }
- }
+ /* Prefer large tiles for scrambling distance, bounded by max num path states. */
+ tile_size.width = min(image_size.x, max_num_path_states);
+ tile_size.height = min(image_size.y, max(max_num_path_states / tile_size.width, 1));
}
else {
/* Calculate tile size as if it is the most possible one to fit an entire range of samples.