[Bf-blender-cvs] [342c4a5ebde] soc-2022-many-lights-sampling: Cleanup: remove position variable from light_tree_distant_light_importance

Brecht Van Lommel noreply at git.blender.org
Fri Oct 7 14:11:44 CEST 2022


Commit: 342c4a5ebde7c95dac08049ed12ad83a697e1970
Author: Brecht Van Lommel
Date:   Fri Oct 7 13:14:15 2022 +0200
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rB342c4a5ebde7c95dac08049ed12ad83a697e1970

Cleanup: remove position variable from light_tree_distant_light_importance

Differential Revision: https://developer.blender.org/D16151

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

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 1d1ea67a467..5c23b9982fe 100644
--- a/intern/cycles/kernel/light/light_tree.h
+++ b/intern/cycles/kernel/light/light_tree.h
@@ -422,7 +422,6 @@ ccl_device bool light_tree_sample(KernelGlobals kg,
 }
 
 ccl_device float light_tree_distant_light_importance(KernelGlobals kg,
-                                                     const float3 P,
                                                      const float3 N,
                                                      const int index)
 {
@@ -468,13 +467,13 @@ ccl_device bool light_tree_sample_distant_lights(KernelGlobals kg,
   const int num_distant_lights = kernel_data.integrator.num_distant_lights;
   float total_importance = 0.0f;
   for (int i = 0; i < num_distant_lights; i++) {
-    total_importance += light_tree_distant_light_importance(kg, P, N, i);
+    total_importance += light_tree_distant_light_importance(kg, N, i);
   }
   const float inv_total_importance = 1.0f / total_importance;
 
   float light_cdf = 0.0f;
   for (int i = 0; i < num_distant_lights; i++) {
-    const float light_pdf = light_tree_distant_light_importance(kg, P, N, i) *
+    const float light_pdf = light_tree_distant_light_importance(kg, N, i) *
                             inv_total_importance;
     if (*randu < light_cdf + light_pdf) {
       *randu = (*randu - light_cdf) / light_pdf;
@@ -503,7 +502,7 @@ ccl_device float light_tree_pdf(
     KernelGlobals kg, ConstIntegratorState state, const float3 P, const float3 N, const int prim)
 {
   float distant_light_importance = light_tree_distant_light_importance(
-      kg, P, N, kernel_data.integrator.num_distant_lights);
+      kg, N, kernel_data.integrator.num_distant_lights);
   float light_tree_importance = 0.0f;
   if (kernel_data.integrator.num_distribution > kernel_data.integrator.num_distant_lights) {
     const ccl_global KernelLightTreeNode *kroot = &kernel_data_fetch(light_tree_nodes, 0);
@@ -647,7 +646,7 @@ ccl_device float distant_lights_pdf(KernelGlobals kg,
                                     const int prim)
 {
   float distant_light_importance = light_tree_distant_light_importance(
-      kg, P, N, kernel_data.integrator.num_distant_lights);
+      kg, N, kernel_data.integrator.num_distant_lights);
   float light_tree_importance = 0.0f;
   if (kernel_data.integrator.num_distribution > kernel_data.integrator.num_distant_lights) {
     const ccl_global KernelLightTreeNode *kroot = &kernel_data_fetch(light_tree_nodes, 0);
@@ -665,7 +664,7 @@ ccl_device float distant_lights_pdf(KernelGlobals kg,
   float emitter_importance = 0.0f;
   float total_importance = 0.0f;
   for (int i = 0; i < num_distant_lights; i++) {
-    float importance = light_tree_distant_light_importance(kg, P, N, i);
+    float importance = light_tree_distant_light_importance(kg, N, i);
     if (i == distant_light) {
       emitter_importance = importance;
     }
@@ -690,7 +689,7 @@ ccl_device bool light_tree_sample_from_position(KernelGlobals kg,
   /* to-do: with weighted reservoir sampling, we can also try picking a sample from the distant
    * light group and compare it to the sample from the light tree. */
   float distant_light_importance = light_tree_distant_light_importance(
-      kg, P, N, kernel_data.integrator.num_distant_lights);
+      kg, N, kernel_data.integrator.num_distant_lights);
   float light_tree_importance = 0.0f;
   if (kernel_data.integrator.num_distribution > kernel_data.integrator.num_distant_lights) {
     const ccl_global KernelLightTreeNode *kroot = &kernel_data_fetch(light_tree_nodes, 0);



More information about the Bf-blender-cvs mailing list