Cycles: Fix denoising passes being written when they're not actually generated
authorLukas Stockner <lukas.stockner@freenet.de>
Fri, 9 Jun 2017 21:02:56 +0000 (23:02 +0200)
committerLukas Stockner <lukas.stockner@freenet.de>
Fri, 9 Jun 2017 21:02:56 +0000 (23:02 +0200)
intern/cycles/blender/addon/engine.py
intern/cycles/blender/addon/properties.py
intern/cycles/blender/blender_session.cpp
intern/cycles/blender/blender_sync.cpp
intern/cycles/blender/blender_sync.h

index b5149b5082ede68254968a7969ba52e5b2870ba2..3018fd5b316ad5a2903c3319aca9e61f148f7637 100644 (file)
@@ -239,7 +239,8 @@ def register_passes(engine, scene, srl):
     if crl.pass_debug_bvh_intersections:       engine.register_pass(scene, srl, "Debug BVH Intersections",       1, "X", 'VALUE')
     if crl.pass_debug_ray_bounces:             engine.register_pass(scene, srl, "Debug Ray Bounces",             1, "X", 'VALUE')
 
-    if crl.use_denoising and crl.denoising_store_passes:
+    cscene = scene.cycles
+    if crl.use_denoising and crl.denoising_store_passes and not cscene.use_progressive_refine:
         engine.register_pass(scene, srl, "Denoising Normal",          3, "XYZ", 'VECTOR')
         engine.register_pass(scene, srl, "Denoising Normal Variance", 3, "XYZ", 'VECTOR')
         engine.register_pass(scene, srl, "Denoising Albedo",          3, "RGB", 'COLOR')
index 8bb25aba13c740f0e37ba3735b69a336cfc69bee..127e3bd7861aa6bda38c5f2548fd6858cc0259fd 100644 (file)
@@ -1209,6 +1209,7 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
                 name="Use Denoising",
                 description="Denoise the rendered image",
                 default=False,
+                update=update_render_passes,
                 )
         cls.denoising_diffuse_direct = BoolProperty(
                 name="Diffuse Direct",
index c6a595775071e82b494901b9b11148d2bbba5081..2b5dd5eadea636141a6276bd9ba3082fabf2257f 100644 (file)
@@ -399,14 +399,7 @@ void BlenderSession::render()
                BL::RenderLayer b_rlay = *b_single_rlay;
 
                /* add passes */
-               array<Pass> passes;
-               if(session_params.device.advanced_shading) {
-                       passes = sync->sync_render_passes(b_rlay, *b_layer_iter);
-               }
-               else {
-                       Pass::add(PASS_COMBINED, passes);
-               }
-
+               array<Pass> passes = sync->sync_render_passes(b_rlay, *b_layer_iter, session_params);
                buffer_params.passes = passes;
 
                PointerRNA crl = RNA_pointer_get(&b_layer_iter->ptr, "cycles");
index 4172359987418f5ffc38901f90b6ca328bc5cc00..3a00384458a74919fc4c51031ac6a9f0d29c759f 100644 (file)
@@ -553,11 +553,16 @@ int BlenderSync::get_denoising_pass(BL::RenderPass& b_pass)
 }
 
 array<Pass> BlenderSync::sync_render_passes(BL::RenderLayer& b_rlay,
-                                            BL::SceneRenderLayer& b_srlay)
+                                            BL::SceneRenderLayer& b_srlay,
+                                            const SessionParams &session_params)
 {
        array<Pass> passes;
        Pass::add(PASS_COMBINED, passes);
 
+       if(!session_params.device.advanced_shading) {
+               return passes;
+       }
+
        /* loop over passes */
        BL::RenderLayer::passes_iterator b_pass_iter;
 
@@ -572,7 +577,9 @@ array<Pass> BlenderSync::sync_render_passes(BL::RenderLayer& b_rlay,
        }
 
        PointerRNA crp = RNA_pointer_get(&b_srlay.ptr, "cycles");
-       if(get_boolean(crp, "denoising_store_passes")) {
+       if(get_boolean(crp, "denoising_store_passes") &&
+          get_boolean(crp, "use_denoising") &&
+          !session_params.progressive_refine) {
                b_engine.add_pass("Denoising Normal",          3, "XYZ", b_srlay.name().c_str());
                b_engine.add_pass("Denoising Normal Variance", 3, "XYZ", b_srlay.name().c_str());
                b_engine.add_pass("Denoising Albedo",          3, "RGB", b_srlay.name().c_str());
index 0950285d976dfd372ef052f30763b9555874519b..4ec46424b5a4303aa0342dc58d423018e54601f6 100644 (file)
@@ -68,7 +68,8 @@ public:
                       const char *layer = 0);
        void sync_render_layers(BL::SpaceView3D& b_v3d, const char *layer);
        array<Pass> sync_render_passes(BL::RenderLayer& b_rlay,
-                                      BL::SceneRenderLayer& b_srlay);
+                                      BL::SceneRenderLayer& b_srlay,
+                                      const SessionParams &session_params);
        void sync_integrator();
        void sync_camera(BL::RenderSettings& b_render,
                         BL::Object& b_override,