Commit: d879cb9f4c1f85cbd38d3fae93aa078bd42a2138
Author: Brecht Van Lommel
Date:   Wed Nov 16 17:43:39 2022 +0100
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rBd879cb9f4c1f85cbd38d3fae93aa078bd42a2138

UI changes:
* Rename Many Lights Sampling panel to Lights, move checkbox inside
* Remove splitting threshold from UI
* Don't use light tree setting as part of sampling preset, it's doesn't really
  make sense to potentially turn it on or off when changing sampling quality
* Disable light threshold when using light tree, it's likely worse to discard
  low contribution samples since we are already sampling them with lower
  probability now.

===================================================================

M       intern/cycles/blender/addon/presets.py
M       intern/cycles/blender/addon/properties.py
M       intern/cycles/blender/addon/ui.py
M       intern/cycles/blender/sync.cpp
M       intern/cycles/kernel/data_template.h
M       intern/cycles/kernel/light/tree.h
M       intern/cycles/scene/integrator.cpp
M       intern/cycles/scene/integrator.h

===================================================================

diff --git a/intern/cycles/blender/addon/presets.py 
b/intern/cycles/blender/addon/presets.py
index a2c43126f15..e1f08c07eaf 100644
--- a/intern/cycles/blender/addon/presets.py
+++ b/intern/cycles/blender/addon/presets.py
@@ -49,8 +49,6 @@ class AddPresetSampling(AddPresetBase, Operator):
         "cycles.samples",
         "cycles.adaptive_threshold",
         "cycles.adaptive_min_samples",
-        "cycles.use_light_tree",
-        "cycles.splitting_threshold",
         "cycles.time_limit",
         "cycles.use_denoising",
         "cycles.denoiser",
diff --git a/intern/cycles/blender/addon/properties.py 
b/intern/cycles/blender/addon/properties.py
index 9497dc7a99b..2fb0b2b702a 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -483,18 +483,10 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
 
     use_light_tree: BoolProperty(
         name="Light Tree",
-        description="Samples many lights more efficiently",
+        description="Sample multiple lights more efficiently based on 
estimated contribution at every shading point",
         default=True,
     )
 
-    splitting_threshold: FloatProperty(
-        name="Splitting",
-        description="Amount of light tree emitters to consider at a time, from 
one light at 0.0, "
-        "to adaptively more lights as needed, to all branches at 1.0",
-        min=0.0, max=1.0,
-        default=0.85,
-    )
-
     min_light_bounces: IntProperty(
         name="Min Light Bounces",
         description="Minimum number of light bounces. Setting this higher 
reduces noise in the first bounces, "
diff --git a/intern/cycles/blender/addon/ui.py 
b/intern/cycles/blender/addon/ui.py
index 088c1b71921..ed94640b839 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -381,7 +381,6 @@ class 
CYCLES_RENDER_PT_sampling_advanced(CyclesButtonsPanel, Panel):
         col = layout.column(align=True)
         col.prop(cscene, "min_light_bounces")
         col.prop(cscene, "min_transparent_bounces")
-        col.prop(cscene, "light_sampling_threshold", text="Light Threshold")
 
         for view_layer in scene.view_layers:
             if view_layer.samples > 0:
@@ -390,8 +389,8 @@ class 
CYCLES_RENDER_PT_sampling_advanced(CyclesButtonsPanel, Panel):
                 break
 
 
-class CYCLES_RENDER_PT_sampling_light_tree(CyclesButtonsPanel, Panel):
-    bl_label = "Many Lights Sampling"
+class CYCLES_RENDER_PT_sampling_lights(CyclesButtonsPanel, Panel):
+    bl_label = "Lights"
     bl_parent_id = "CYCLES_RENDER_PT_sampling"
     bl_options = {'DEFAULT_CLOSED'}
 
@@ -400,8 +399,6 @@ class 
CYCLES_RENDER_PT_sampling_light_tree(CyclesButtonsPanel, Panel):
         scene = context.scene
         cscene = scene.cycles
 
-        layout.prop(cscene, "use_light_tree", text="")
-
     def draw(self, context):
         layout = self.layout
         layout.use_property_split = True
@@ -410,9 +407,11 @@ class 
CYCLES_RENDER_PT_sampling_light_tree(CyclesButtonsPanel, Panel):
         scene = context.scene
         cscene = scene.cycles
 
-        layout.active = cscene.use_light_tree
         col = layout.column(align=True)
-        col.prop(cscene, "splitting_threshold", text="Split Threshold")
+        col.prop(cscene, "use_light_tree")
+        sub = col.row()
+        sub.prop(cscene, "light_sampling_threshold", text="Light Threshold")
+        sub.active = not cscene.use_light_tree
 
 
 class CYCLES_RENDER_PT_subdivision(CyclesButtonsPanel, Panel):
@@ -2389,8 +2388,8 @@ classes = (
     CYCLES_RENDER_PT_sampling_render_denoise,
     CYCLES_RENDER_PT_sampling_path_guiding,
     CYCLES_RENDER_PT_sampling_path_guiding_debug,
+    CYCLES_RENDER_PT_sampling_lights,
     CYCLES_RENDER_PT_sampling_advanced,
-    CYCLES_RENDER_PT_sampling_light_tree,
     CYCLES_RENDER_PT_light_paths,
     CYCLES_RENDER_PT_light_paths_max_bounces,
     CYCLES_RENDER_PT_light_paths_clamping,
diff --git a/intern/cycles/blender/sync.cpp b/intern/cycles/blender/sync.cpp
index 3894e0665aa..5216219db96 100644
--- a/intern/cycles/blender/sync.cpp
+++ b/intern/cycles/blender/sync.cpp
@@ -348,10 +348,10 @@ void BlenderSync::sync_integrator(BL::ViewLayer 
&b_view_layer, bool background)
     integrator->set_motion_blur(view_layer.use_motion_blur);
   }
 
-  integrator->set_light_sampling_threshold(get_float(cscene, 
"light_sampling_threshold"));
-
-  integrator->set_use_light_tree(get_boolean(cscene, "use_light_tree"));
-  integrator->set_splitting_threshold(get_float(cscene, 
"splitting_threshold"));
+  bool use_light_tree = get_boolean(cscene, "use_light_tree");
+  integrator->set_use_light_tree(use_light_tree);
+  integrator->set_light_sampling_threshold(
+      (use_light_tree) ? get_float(cscene, "light_sampling_threshold") : 0.0f);
 
   if (integrator->use_light_tree_is_modified()) {
     scene->light_manager->tag_update(scene, LightManager::UPDATE_ALL);
diff --git a/intern/cycles/kernel/data_template.h 
b/intern/cycles/kernel/data_template.h
index 6b1113adce9..30b326d27b0 100644
--- a/intern/cycles/kernel/data_template.h
+++ b/intern/cycles/kernel/data_template.h
@@ -198,7 +198,6 @@ KERNEL_STRUCT_MEMBER(integrator, int, filter_closures)
 KERNEL_STRUCT_MEMBER(integrator, int, direct_light_sampling_type)
 /* Light tree. */
 KERNEL_STRUCT_MEMBER(integrator, int, use_light_tree)
-KERNEL_STRUCT_MEMBER(integrator, float, splitting_threshold)
 /* Path Guiding */
 KERNEL_STRUCT_MEMBER(integrator, float, surface_guiding_probability)
 KERNEL_STRUCT_MEMBER(integrator, float, volume_guiding_probability)
@@ -211,6 +210,7 @@ KERNEL_STRUCT_MEMBER(integrator, int, 
use_guiding_direct_light)
 KERNEL_STRUCT_MEMBER(integrator, int, use_guiding_mis_weights)
 /* Padding */
 KERNEL_STRUCT_MEMBER(integrator, int, pad1)
+KERNEL_STRUCT_MEMBER(integrator, int, pad2)
 KERNEL_STRUCT_END(KernelIntegrator)
 
 /* SVM. For shader specialization. */
diff --git a/intern/cycles/kernel/light/tree.h 
b/intern/cycles/kernel/light/tree.h
index ab4cbac326e..d0d4e7f58ef 100644
--- a/intern/cycles/kernel/light/tree.h
+++ b/intern/cycles/kernel/light/tree.h
@@ -318,7 +318,7 @@ ccl_device bool light_tree_should_split(KernelGlobals kg,
    * later. */
   return false;
 
-  const float splitting_threshold = kernel_data.integrator.splitting_threshold;
+  const float splitting_threshold = 0.5f;
   if (splitting_threshold == 0.0f) {
     return false;
   }
diff --git a/intern/cycles/scene/integrator.cpp 
b/intern/cycles/scene/integrator.cpp
index 74620ad7e37..96a09563925 100644
--- a/intern/cycles/scene/integrator.cpp
+++ b/intern/cycles/scene/integrator.cpp
@@ -102,10 +102,8 @@ NODE_DEFINE(Integrator)
   SOCKET_FLOAT(adaptive_threshold, "Adaptive Threshold", 0.01f);
   SOCKET_INT(adaptive_min_samples, "Adaptive Min Samples", 0);
 
-  SOCKET_FLOAT(light_sampling_threshold, "Light Sampling Threshold", 0.01f);
-
-  SOCKET_BOOLEAN(use_light_tree, "Use light tree to optimize many light 
sampling", false);
-  SOCKET_FLOAT(splitting_threshold, "Splitting threshold", 0.85f);
+  SOCKET_BOOLEAN(use_light_tree, "Use light tree to optimize many light 
sampling", true);
+  SOCKET_FLOAT(light_sampling_threshold, "Light Sampling Threshold", 0.0f);
 
   static NodeEnum sampling_pattern_enum;
   sampling_pattern_enum.insert("sobol_burley", SAMPLING_PATTERN_SOBOL_BURLEY);
@@ -184,9 +182,6 @@ void Integrator::device_update(Device *device, DeviceScene 
*dscene, Scene *scene
   kintegrator->direct_light_sampling_type = DIRECT_LIGHT_SAMPLING_MIS;
 #endif
 
-  kintegrator->use_light_tree = scene->integrator->use_light_tree;
-  kintegrator->splitting_threshold = scene->integrator->splitting_threshold;
-
   /* Transparent Shadows
    * We only need to enable transparent shadows, if we actually have
    * transparent shaders in the scene. Otherwise we can disable it
@@ -256,6 +251,7 @@ void Integrator::device_update(Device *device, DeviceScene 
*dscene, Scene *scene
   kintegrator->sampling_pattern = sampling_pattern;
   kintegrator->scrambling_distance = scrambling_distance;
 
+  kintegrator->use_light_tree = scene->integrator->use_light_tree;
   if (light_sampling_threshold > 0.0f) {
     kintegrator->light_inv_rr_threshold = 1.0f / light_sampling_threshold;
   }
diff --git a/intern/cycles/scene/integrator.h b/intern/cycles/scene/integrator.h
index e9c8eaffabb..92ac3a254b7 100644
--- a/intern/cycles/scene/integrator.h
+++ b/intern/cycles/scene/integrator.h
@@ -79,9 +79,8 @@ class Integrator : public Node {
   NODE_SOCKET_API(int, aa_samples)
   NODE_SOCKET_API(int, start_sample)
 
-  NODE_SOCKET_API(float, light_sampling_threshold)
   NODE_SOCKET_API(bool, use_light_tree)
-  NODE_SOCKET_API(float, splitting_threshold)
+  NODE_SOCKET_API(float, light_sampling_threshold)
 
   NODE_SOCKET_API(bool, use_adaptive_sampling)
   NODE_SOCKET_API(int, adaptive_min_samples)

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to