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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-06-07 20:06:22 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-06-07 20:06:22 +0400
commitb20a7e01d046b95a79663da1a8072358709a5a8b (patch)
tree7772c50756a7d5a3352fd25eadbe8d41aa776615 /intern/cycles/render
parentd835d2f4e65ae3bf8e22f8d3d60e7e6ea7a6b4ca (diff)
Cycles: experimental correlated multi-jittered sampling pattern that can be used
instead of sobol. So far one doesn't seem to be consistently better or worse than the other for the same number of samples but more testing is needed. The random number generator itself is slower than sobol for most number of samples, except 16, 64, 256, .. because they can be computed faster. This can probably be optimized, but we can do that when/if this actually turns out to be useful. Paper this implementation is based on: http://graphics.pixar.com/library/MultiJitteredSampling/ Also includes some refactoring of RNG code, fixing a Sobol correlation issue with the first BSDF and < 16 samples, skipping some unneeded RNG calls and using a simpler unit square to unit disk function.
Diffstat (limited to 'intern/cycles/render')
-rw-r--r--intern/cycles/render/integrator.cpp7
-rw-r--r--intern/cycles/render/integrator.h5
-rw-r--r--intern/cycles/render/session.cpp13
3 files changed, 25 insertions, 0 deletions
diff --git a/intern/cycles/render/integrator.cpp b/intern/cycles/render/integrator.cpp
index 731ffd9e271..cc369e7abc9 100644
--- a/intern/cycles/render/integrator.cpp
+++ b/intern/cycles/render/integrator.cpp
@@ -49,6 +49,7 @@ Integrator::Integrator()
sample_clamp = 0.0f;
motion_blur = false;
+ aa_samples = 0;
diffuse_samples = 1;
glossy_samples = 1;
transmission_samples = 1;
@@ -57,6 +58,8 @@ Integrator::Integrator()
subsurface_samples = 1;
progressive = true;
+ sampling_pattern = SAMPLING_PATTERN_SOBOL;
+
need_update = true;
}
@@ -104,6 +107,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
kintegrator->sample_clamp = (sample_clamp == 0.0f)? FLT_MAX: sample_clamp*3.0f;
kintegrator->progressive = progressive;
+ kintegrator->aa_samples = aa_samples;
kintegrator->diffuse_samples = diffuse_samples;
kintegrator->glossy_samples = glossy_samples;
kintegrator->transmission_samples = transmission_samples;
@@ -111,6 +115,8 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
kintegrator->mesh_light_samples = mesh_light_samples;
kintegrator->subsurface_samples = subsurface_samples;
+ kintegrator->sampling_pattern = sampling_pattern;
+
/* sobol directions table */
int max_samples = 1;
@@ -160,6 +166,7 @@ bool Integrator::modified(const Integrator& integrator)
seed == integrator.seed &&
sample_clamp == integrator.sample_clamp &&
progressive == integrator.progressive &&
+ aa_samples == integrator.aa_samples &&
diffuse_samples == integrator.diffuse_samples &&
glossy_samples == integrator.glossy_samples &&
transmission_samples == integrator.transmission_samples &&
diff --git a/intern/cycles/render/integrator.h b/intern/cycles/render/integrator.h
index 9867e310d4d..fff24b506fb 100644
--- a/intern/cycles/render/integrator.h
+++ b/intern/cycles/render/integrator.h
@@ -19,6 +19,8 @@
#ifndef __INTEGRATOR_H__
#define __INTEGRATOR_H__
+#include "kernel_types.h"
+
CCL_NAMESPACE_BEGIN
class Device;
@@ -49,6 +51,7 @@ public:
float sample_clamp;
bool motion_blur;
+ int aa_samples;
int diffuse_samples;
int glossy_samples;
int transmission_samples;
@@ -58,6 +61,8 @@ public:
bool progressive;
+ SamplingPattern sampling_pattern;
+
bool need_update;
Integrator();
diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp
index bc847d5719c..44364418dcf 100644
--- a/intern/cycles/render/session.cpp
+++ b/intern/cycles/render/session.cpp
@@ -22,6 +22,7 @@
#include "buffers.h"
#include "camera.h"
#include "device.h"
+#include "integrator.h"
#include "scene.h"
#include "session.h"
@@ -728,6 +729,18 @@ void Session::update_scene()
cam->tag_update();
}
+ /* number of samples is needed by multi jittered sampling pattern */
+ Integrator *integrator = scene->integrator;
+
+ if(integrator->sampling_pattern == SAMPLING_PATTERN_CMJ) {
+ int aa_samples = tile_manager.num_samples;
+
+ if(aa_samples != integrator->aa_samples) {
+ integrator->aa_samples = aa_samples;
+ integrator->tag_update(scene);
+ }
+ }
+
/* update scene */
if(scene->need_update()) {
progress.set_status("Updating Scene");