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:
Diffstat (limited to 'intern/cycles/scene/integrator.cpp')
-rw-r--r--intern/cycles/scene/integrator.cpp71
1 files changed, 19 insertions, 52 deletions
diff --git a/intern/cycles/scene/integrator.cpp b/intern/cycles/scene/integrator.cpp
index fda6ecc8d14..e9cd753854f 100644
--- a/intern/cycles/scene/integrator.cpp
+++ b/intern/cycles/scene/integrator.cpp
@@ -13,7 +13,6 @@
#include "scene/object.h"
#include "scene/scene.h"
#include "scene/shader.h"
-#include "scene/sobol.h"
#include "scene/stats.h"
#include "kernel/types.h"
@@ -87,9 +86,9 @@ NODE_DEFINE(Integrator)
SOCKET_FLOAT(light_sampling_threshold, "Light Sampling Threshold", 0.01f);
static NodeEnum sampling_pattern_enum;
- sampling_pattern_enum.insert("sobol", SAMPLING_PATTERN_SOBOL);
+ sampling_pattern_enum.insert("sobol_burley", SAMPLING_PATTERN_SOBOL_BURLEY);
sampling_pattern_enum.insert("pmj", SAMPLING_PATTERN_PMJ);
- SOCKET_ENUM(sampling_pattern, "Sampling Pattern", sampling_pattern_enum, SAMPLING_PATTERN_SOBOL);
+ SOCKET_ENUM(sampling_pattern, "Sampling Pattern", sampling_pattern_enum, SAMPLING_PATTERN_PMJ);
SOCKET_FLOAT(scrambling_distance, "Scrambling Distance", 1.0f);
static NodeEnum denoiser_type_enum;
@@ -138,23 +137,6 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
KernelIntegrator *kintegrator = &dscene->data.integrator;
- /* Adaptive sampling requires PMJ samples.
- *
- * This also makes detection of sampling pattern a bit more involved: can not rely on the changed
- * state of socket, since its value might be different from the effective value used here. So
- * instead compare with previous value in the KernelIntegrator. Only do it if the device was
- * updated once (in which case the `sample_pattern_lut` will be allocated to a non-zero size). */
- const SamplingPattern new_sampling_pattern = (use_adaptive_sampling) ? SAMPLING_PATTERN_PMJ :
- sampling_pattern;
-
- const bool need_update_lut = max_bounce_is_modified() || max_transmission_bounce_is_modified() ||
- dscene->sample_pattern_lut.size() == 0 ||
- kintegrator->sampling_pattern != new_sampling_pattern;
-
- if (need_update_lut) {
- dscene->sample_pattern_lut.tag_realloc();
- }
-
device_free(device, dscene);
/* integrator parameters */
@@ -235,7 +217,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
FLT_MAX :
sample_clamp_indirect * 3.0f;
- kintegrator->sampling_pattern = new_sampling_pattern;
+ kintegrator->sampling_pattern = sampling_pattern;
kintegrator->scrambling_distance = scrambling_distance;
if (light_sampling_threshold > 0.0f) {
@@ -245,36 +227,21 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
kintegrator->light_inv_rr_threshold = 0.0f;
}
- /* sobol directions table */
- int max_samples = max_bounce + transparent_max_bounce + 3 + VOLUME_BOUNDS_MAX +
- max(BSSRDF_MAX_HITS, BSSRDF_MAX_BOUNCES);
-
- int dimensions = PRNG_BASE_NUM + max_samples * PRNG_BOUNCE_NUM;
- dimensions = min(dimensions, SOBOL_MAX_DIMENSIONS);
-
- if (need_update_lut) {
- if (kintegrator->sampling_pattern == SAMPLING_PATTERN_SOBOL) {
- uint *directions = (uint *)dscene->sample_pattern_lut.alloc(SOBOL_BITS * dimensions);
-
- sobol_generate_direction_vectors((uint(*)[SOBOL_BITS])directions, dimensions);
-
- dscene->sample_pattern_lut.copy_to_device();
+ if (kintegrator->sampling_pattern == SAMPLING_PATTERN_PMJ &&
+ dscene->sample_pattern_lut.size() == 0) {
+ constexpr int sequence_size = NUM_PMJ_SAMPLES;
+ constexpr int num_sequences = NUM_PMJ_PATTERNS;
+ float2 *directions = (float2 *)dscene->sample_pattern_lut.alloc(sequence_size * num_sequences *
+ 2);
+ TaskPool pool;
+ for (int j = 0; j < num_sequences; ++j) {
+ float2 *sequence = directions + j * sequence_size;
+ pool.push(
+ function_bind(&progressive_multi_jitter_02_generate_2D, sequence, sequence_size, j));
}
- else {
- constexpr int sequence_size = NUM_PMJ_SAMPLES;
- constexpr int num_sequences = NUM_PMJ_PATTERNS;
- float2 *directions = (float2 *)dscene->sample_pattern_lut.alloc(sequence_size *
- num_sequences * 2);
- TaskPool pool;
- for (int j = 0; j < num_sequences; ++j) {
- float2 *sequence = directions + j * sequence_size;
- pool.push(
- function_bind(&progressive_multi_jitter_02_generate_2D, sequence, sequence_size, j));
- }
- pool.wait_work();
+ pool.wait_work();
- dscene->sample_pattern_lut.copy_to_device();
- }
+ dscene->sample_pattern_lut.copy_to_device();
}
kintegrator->has_shadow_catcher = scene->has_shadow_catcher();
@@ -338,7 +305,7 @@ AdaptiveSampling Integrator::get_adaptive_sampling() const
if (aa_samples > 0 && adaptive_threshold == 0.0f) {
adaptive_sampling.threshold = max(0.001f, 1.0f / (float)aa_samples);
- VLOG(1) << "Cycles adaptive sampling: automatic threshold = " << adaptive_sampling.threshold;
+ VLOG_INFO << "Cycles adaptive sampling: automatic threshold = " << adaptive_sampling.threshold;
}
else {
adaptive_sampling.threshold = adaptive_threshold;
@@ -350,8 +317,8 @@ AdaptiveSampling Integrator::get_adaptive_sampling() const
* in various test scenes. */
const int min_samples = (int)ceilf(16.0f / powf(adaptive_sampling.threshold, 0.3f));
adaptive_sampling.min_samples = max(4, min_samples);
- VLOG(1) << "Cycles adaptive sampling: automatic min samples = "
- << adaptive_sampling.min_samples;
+ VLOG_INFO << "Cycles adaptive sampling: automatic min samples = "
+ << adaptive_sampling.min_samples;
}
else {
adaptive_sampling.min_samples = max(4, adaptive_min_samples);