Merge branch 'master' into blender2.8
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Tue, 30 Oct 2018 13:13:47 +0000 (14:13 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Tue, 30 Oct 2018 13:13:47 +0000 (14:13 +0100)
intern/cycles/blender/addon/engine.py
intern/cycles/blender/addon/ui.py
intern/cycles/blender/blender_session.cpp
intern/cycles/blender/blender_sync.cpp
intern/cycles/kernel/kernel_types.h
intern/cycles/render/session.cpp
intern/cycles/render/session.h

index 25708a0f888534f966f1c6167fb7ca1b8e400ef0..778aa2dba8de0047ed041ba84be2317d4a1dfb49 100644 (file)
@@ -268,7 +268,7 @@ def register_passes(engine, scene, srl):
         for i in range(0, srl.cycles.pass_crypto_depth, 2):
             engine.register_pass(scene, srl, "CryptoAsset" + '{:02d}'.format(i), 4, "RGBA", 'COLOR')
 
-    if crl.use_denoising:
+    if crl.use_denoising or crl.denoising_store_passes:
         engine.register_pass(scene, srl, "Noisy Image", 3, "RGBA", 'COLOR')
         if crl.denoising_store_passes:
             engine.register_pass(scene, srl, "Denoising Normal",          3, "XYZ", 'VECTOR')
index 7aa66fac31fd2292e4a1c7e76155fea3a773fdf8..d172fd0b4c80496c19dfb808947a085cc59dca48 100644 (file)
@@ -771,6 +771,8 @@ class CYCLES_RENDER_PT_layer_passes(CyclesButtonsPanel, Panel):
         col.prop(view_layer, "use_pass_shadow")
         col.prop(view_layer, "use_pass_ambient_occlusion", text="Ambient Occlusion")
         col.separator()
+        col.prop(cycles_view_layer, "denoising_store_passes", text="Denoising Data")
+        col.separator()
         col.prop(view_layer, "pass_alpha_threshold")
 
         col = split.column()
@@ -803,12 +805,6 @@ class CYCLES_RENDER_PT_layer_passes(CyclesButtonsPanel, Panel):
         col.prop(view_layer, "use_pass_emit", text="Emission")
         col.prop(view_layer, "use_pass_environment")
 
-        if context.scene.cycles.feature_set == 'EXPERIMENTAL':
-            col.separator()
-            sub = col.column()
-            sub.active = cycles_view_layer.use_denoising
-            sub.prop(cycles_view_layer, "denoising_store_passes", text="Denoising")
-
         col = layout.column()
         col.prop(cycles_view_layer, "pass_debug_render_time")
         if _cycles.with_cycles_debug:
@@ -853,66 +849,40 @@ class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel):
         view_layer = context.view_layer
         cycles_view_layer = view_layer.cycles
 
-        layout.active = cycles_view_layer.use_denoising
-
-        col = layout.column()
-        sub = col.column()
-        sub.prop(cycles_view_layer, "denoising_radius", text="Radius")
-        sub.prop(cycles_view_layer, "denoising_strength", slider=True, text="Strength")
-
-        sub = col.column(align=True)
-        sub.prop(cycles_view_layer, "denoising_feature_strength", slider=True, text="Feature Strength")
-        sub.prop(cycles_view_layer, "denoising_relative_pca")
+        split = layout.split()
+        split.active = cycles_view_layer.use_denoising
 
-#        layout.use_property_split = False
+        layout = layout.column(align=True)
+        layout.prop(cycles_view_layer, "denoising_feature_strength", slider=True, text="Feature Strength")
+        layout.prop(cycles_view_layer, "denoising_relative_pca")
 
-        """
         layout.separator()
 
-        col = layout.column(align=True)
-        col.prop(cycles_view_layer, "denoising_diffuse_direct", text="Diffuse Direct")
-        col.prop(cycles_view_layer, "denoising_diffuse_indirect", text="Indirect")
-
-        col = layout.column(align=True)
-        col.prop(cycles_view_layer, "denoising_glossy_direct", text="Glossy Direct")
-        col.prop(cycles_view_layer, "denoising_glossy_indirect", text="Indirect")
-
-        col = layout.column(align=True)
-        col.prop(cycles_view_layer, "denoising_transmission_direct", text="Transmission Direct")
-        col.prop(cycles_view_layer, "denoising_transmission_indirect", text="Indirect")
-
-        col = layout.column(align=True)
-        col.prop(cycles_view_layer, "denoising_subsurface_direct", text="Subsurface Direct")
-        col.prop(cycles_view_layer, "denoising_subsurface_indirect", text="Indirect")
-        """
-
-        layout.use_property_split = False
-
-        split = layout.split(factor=0.5)
-        split.label(text="Diffuse")
-        col = split.column()
-        row = col.row(align=True)
+        row = layout.row(align=True)
+        row.active = cycles_view_layer.use_denoising or cycles_view_layer.denoising_store_passes
+        row.label(text="Diffuse")
+        row.use_property_split = False
         row.prop(cycles_view_layer, "denoising_diffuse_direct", text="Direct", toggle=True)
         row.prop(cycles_view_layer, "denoising_diffuse_indirect", text="Indirect", toggle=True)
 
-        split = layout.split(factor=0.5)
-        split.label(text="Glossy")
-        col = split.column()
-        row = col.row(align=True)
+        row = layout.row(align=True)
+        row.active = cycles_view_layer.use_denoising or cycles_view_layer.denoising_store_passes
+        row.label(text="Glossy")
+        row.use_property_split = False
         row.prop(cycles_view_layer, "denoising_glossy_direct", text="Direct", toggle=True)
         row.prop(cycles_view_layer, "denoising_glossy_indirect", text="Indirect", toggle=True)
 
-        split = layout.split(factor=0.5)
-        split.label(text="Transmission")
-        col = split.column()
-        row = col.row(align=True)
+        row = layout.row(align=True)
+        row.active = cycles_view_layer.use_denoising or cycles_view_layer.denoising_store_passes
+        row.label(text="Transmission")
+        row.use_property_split = False
         row.prop(cycles_view_layer, "denoising_transmission_direct", text="Direct", toggle=True)
         row.prop(cycles_view_layer, "denoising_transmission_indirect", text="Indirect", toggle=True)
 
-        split = layout.split(factor=0.5)
-        split.label(text="Subsurface")
-        col = split.column()
-        row = col.row(align=True)
+        row = layout.row(align=True)
+        row.active = cycles_view_layer.use_denoising or cycles_view_layer.denoising_store_passes
+        row.label(text="Subsurface")
+        row.use_property_split = False
         row.prop(cycles_view_layer, "denoising_subsurface_direct", text="Direct", toggle=True)
         row.prop(cycles_view_layer, "denoising_subsurface_indirect", text="Indirect", toggle=True)
 
index 1ff15284bc1ae7c2f094a94e7e4474c447b18c60..22a64df0c846a7d7b0a694763df4390c44b3b4fe 100644 (file)
@@ -412,12 +412,14 @@ void BlenderSession::render(BL::Depsgraph& b_depsgraph_)
 
        PointerRNA crl = RNA_pointer_get(&b_view_layer.ptr, "cycles");
        bool use_denoising = get_boolean(crl, "use_denoising");
+       bool denoising_passes = use_denoising || get_boolean(crl, "denoising_store_passes");
 
        session->tile_manager.schedule_denoising = use_denoising;
-       buffer_params.denoising_data_pass = use_denoising;
+       buffer_params.denoising_data_pass = denoising_passes;
        buffer_params.denoising_clean_pass = (scene->film->denoising_flags & DENOISING_CLEAN_ALL_PASSES);
 
        session->params.use_denoising = use_denoising;
+       session->params.denoising_passes = denoising_passes;
        session->params.denoising_radius = get_int(crl, "denoising_radius");
        session->params.denoising_strength = get_float(crl, "denoising_strength");
        session->params.denoising_feature_strength = get_float(crl, "denoising_feature_strength");
index 424894387807b29ac0afda7f55067508a4a9b622..1a3d94b5276fb68d8e00923ea8b9ad0500fc70e8 100644 (file)
@@ -510,9 +510,11 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer& b_rlay,
                        Pass::add(pass_type, passes);
        }
 
-       scene->film->denoising_flags = 0;
        PointerRNA crp = RNA_pointer_get(&b_view_layer.ptr, "cycles");
-       if(get_boolean(crp, "use_denoising")) {
+       bool use_denoising = get_boolean(crp, "use_denoising");
+       bool store_denoising_passes = get_boolean(crp, "denoising_store_passes");
+       scene->film->denoising_flags = 0;
+       if(use_denoising || store_denoising_passes) {
 #define MAP_OPTION(name, flag) if(!get_boolean(crp, name)) scene->film->denoising_flags |= flag;
                MAP_OPTION("denoising_diffuse_direct",        DENOISING_CLEAN_DIFFUSE_DIR);
                MAP_OPTION("denoising_diffuse_indirect",      DENOISING_CLEAN_DIFFUSE_IND);
@@ -523,22 +525,22 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer& b_rlay,
                MAP_OPTION("denoising_subsurface_direct",     DENOISING_CLEAN_SUBSURFACE_DIR);
                MAP_OPTION("denoising_subsurface_indirect",   DENOISING_CLEAN_SUBSURFACE_IND);
 #undef MAP_OPTION
-
                b_engine.add_pass("Noisy Image", 4, "RGBA", b_view_layer.name().c_str());
-               if(get_boolean(crp, "denoising_store_passes")) {
-                       b_engine.add_pass("Denoising Normal",          3, "XYZ", b_view_layer.name().c_str());
-                       b_engine.add_pass("Denoising Normal Variance", 3, "XYZ", b_view_layer.name().c_str());
-                       b_engine.add_pass("Denoising Albedo",          3, "RGB", b_view_layer.name().c_str());
-                       b_engine.add_pass("Denoising Albedo Variance", 3, "RGB", b_view_layer.name().c_str());
-                       b_engine.add_pass("Denoising Depth",           1, "Z",   b_view_layer.name().c_str());
-                       b_engine.add_pass("Denoising Depth Variance",  1, "Z",   b_view_layer.name().c_str());
-                       b_engine.add_pass("Denoising Shadow A",        3, "XYV", b_view_layer.name().c_str());
-                       b_engine.add_pass("Denoising Shadow B",        3, "XYV", b_view_layer.name().c_str());
-                       b_engine.add_pass("Denoising Image Variance",  3, "RGB", b_view_layer.name().c_str());
-
-                       if(scene->film->denoising_flags & DENOISING_CLEAN_ALL_PASSES) {
-                               b_engine.add_pass("Denoising Clean",   3, "RGB", b_view_layer.name().c_str());
-                       }
+       }
+
+       if(store_denoising_passes) {
+               b_engine.add_pass("Denoising Normal",          3, "XYZ", b_view_layer.name().c_str());
+               b_engine.add_pass("Denoising Normal Variance", 3, "XYZ", b_view_layer.name().c_str());
+               b_engine.add_pass("Denoising Albedo",          3, "RGB", b_view_layer.name().c_str());
+               b_engine.add_pass("Denoising Albedo Variance", 3, "RGB", b_view_layer.name().c_str());
+               b_engine.add_pass("Denoising Depth",           1, "Z",   b_view_layer.name().c_str());
+               b_engine.add_pass("Denoising Depth Variance",  1, "Z",   b_view_layer.name().c_str());
+               b_engine.add_pass("Denoising Shadow A",        3, "XYV", b_view_layer.name().c_str());
+               b_engine.add_pass("Denoising Shadow B",        3, "XYV", b_view_layer.name().c_str());
+               b_engine.add_pass("Denoising Image Variance",  3, "RGB", b_view_layer.name().c_str());
+
+               if(scene->film->denoising_flags & DENOISING_CLEAN_ALL_PASSES) {
+                       b_engine.add_pass("Denoising Clean",   3, "RGB", b_view_layer.name().c_str());
                }
        }
 #ifdef __KERNEL_DEBUG__
index f46b06f87f93b987009560c50c784767fbd798c1..230e90c8b312c7f4e3b300e5b27f5c44bc73fda4 100644 (file)
@@ -1278,13 +1278,11 @@ typedef struct KernelFilm {
        float mist_start;
        float mist_inv_depth;
        float mist_falloff;
-       
+
        int pass_denoising_data;
        int pass_denoising_clean;
        int denoising_flags;
 
-       int pad1, pad2;
-
        /* XYZ to rendering color space transform. float4 instead of float3 to
         * ensure consistent padding/alignment across devices. */
        float4 xyz_to_r;
index 8bc175a094db9c96007771d65e6da2f0fc0d8f49..d6ecafa19b7cfe357a7e3744ba49e14a3e932553 100644 (file)
@@ -682,7 +682,7 @@ DeviceRequestedFeatures Session::get_requested_device_features()
        BakeManager *bake_manager = scene->bake_manager;
        requested_features.use_baking = bake_manager->get_baking();
        requested_features.use_integrator_branched = (scene->integrator->method == Integrator::BRANCHED_PATH);
-       if(params.use_denoising) {
+       if(params.denoising_passes) {
                requested_features.use_denoising = true;
                requested_features.use_shadow_tricks = true;
        }
index 61f62f8e7127b978fa1dfcb85086d22e74716429..d2ec13ada1fd00b641d80ae9b65605b1a80aacac 100644 (file)
@@ -58,6 +58,7 @@ public:
        bool display_buffer_linear;
 
        bool use_denoising;
+       bool denoising_passes;
        int denoising_radius;
        float denoising_strength;
        float denoising_feature_strength;
@@ -89,6 +90,7 @@ public:
                threads = 0;
 
                use_denoising = false;
+               denoising_passes = false;
                denoising_radius = 8;
                denoising_strength = 0.0f;
                denoising_feature_strength = 0.0f;