Cycles: Different noise seed for stereoscopic rendering (Fix #T50024)
authorDalai Felinto <dfelinto@gmail.com>
Fri, 18 Nov 2016 17:23:45 +0000 (18:23 +0100)
committerDalai Felinto <dfelinto@gmail.com>
Fri, 18 Nov 2016 17:23:52 +0000 (18:23 +0100)
Patch by Sergey Sharybin.

intern/cycles/blender/blender_session.cpp

index c250a54f259d03df16a0d7985d35ef1d521705f3..171153dd440ddf76041a5ec19e1d1c4f0f18adf9 100644 (file)
@@ -32,6 +32,7 @@
 #include "util_color.h"
 #include "util_foreach.h"
 #include "util_function.h"
+#include "util_hash.h"
 #include "util_logging.h"
 #include "util_progress.h"
 #include "util_time.h"
@@ -498,7 +499,8 @@ void BlenderSession::render()
                scene->film->tag_update(scene);
                scene->integrator->tag_update(scene);
 
-               for(b_rr.views.begin(b_view_iter); b_view_iter != b_rr.views.end(); ++b_view_iter) {
+               int view_index = 0;
+               for(b_rr.views.begin(b_view_iter); b_view_iter != b_rr.views.end(); ++b_view_iter, ++view_index) {
                        b_rview_name = b_view_iter->name();
 
                        /* set the current view */
@@ -514,6 +516,12 @@ void BlenderSession::render()
                                        &python_thread_state,
                                        b_rlay_name.c_str());
 
+                       /* Make sure all views have different noise patterns. - hardcoded value just to make it random */
+                       if(view_index != 0) {
+                               scene->integrator->seed += hash_int_2d(scene->integrator->seed, hash_int(view_index * 0xdeadbeef));
+                               scene->integrator->tag_update(scene);
+                       }
+
                        /* Update number of samples per layer. */
                        int samples = sync->get_layer_samples();
                        bool bound_samples = sync->get_layer_bound_samples();