[Bf-blender-cvs] [279902d6e6f] soc-2022-many-lights-sampling: Cleanup: simplify leaf emitter matching

Brecht Van Lommel noreply at git.blender.org
Mon Sep 12 20:19:07 CEST 2022


Commit: 279902d6e6f03fd7bb2300ffd3a2d7db4ea4996a
Author: Brecht Van Lommel
Date:   Mon Sep 12 20:16:45 2022 +0200
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rB279902d6e6f03fd7bb2300ffd3a2d7db4ea4996a

Cleanup: simplify leaf emitter matching

Contributed by Alaska.

Ref D15936

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

M	intern/cycles/kernel/light/light_tree.h

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

diff --git a/intern/cycles/kernel/light/light_tree.h b/intern/cycles/kernel/light/light_tree.h
index 6d5118117ec..54a4c88ea25 100644
--- a/intern/cycles/kernel/light/light_tree.h
+++ b/intern/cycles/kernel/light/light_tree.h
@@ -558,12 +558,9 @@ ccl_device float light_tree_pdf(
         float target_emitter_importance = 0.0f;
         float total_emitter_importance = 0.0f;
         for (int i = 0; i < knode->num_prims; i++) {
-          const int prim_index = -knode->child_index + i;
-          float light_importance = light_tree_emitter_importance(kg, P, N, prim_index);
-          ccl_global const KernelLightTreeEmitter *kemitter = &kernel_data_fetch(
-              light_tree_emitters, prim_index);
-          if (kemitter->prim_id == prim) {
-            selected_light = prim_index;
+          const int leaf_emitter = -knode->child_index + i;
+          float light_importance = light_tree_emitter_importance(kg, P, N, leaf_emitter);
+          if (leaf_emitter == emitter) {
             light_weight = light_tree_emitter_reservoir_weight(kg, P, N, selected_light);
             target_weight = light_weight;
             target_emitter_importance = light_importance;



More information about the Bf-blender-cvs mailing list