[Bf-blender-cvs] [5c718884b72] soc-2022-many-lights-sampling: Fix normalized vector used when computing `closest_point`

Weizhen Huang noreply at git.blender.org
Thu Nov 24 17:05:20 CET 2022


Commit: 5c718884b72b35e5350382f193d6883c4b87c2ec
Author: Weizhen Huang
Date:   Thu Nov 24 17:04:38 2022 +0100
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rB5c718884b72b35e5350382f193d6883c4b87c2ec

Fix normalized vector used when computing `closest_point`

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

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

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

diff --git a/intern/cycles/kernel/light/tree.h b/intern/cycles/kernel/light/tree.h
index dc7c1b3219a..f80935efd58 100644
--- a/intern/cycles/kernel/light/tree.h
+++ b/intern/cycles/kernel/light/tree.h
@@ -290,7 +290,7 @@ ccl_device void light_tree_emitter_importance(KernelGlobals kg,
   /* TODO: better measure for single emitter */
   if (in_volume_segment) {
     const float3 D = N_or_D;
-    const float3 closest_point = P + D * dot(point_to_centroid, D);
+    const float3 closest_point = P + distance * dot(point_to_centroid, D) * D;
     /* minimal distance of the ray to the cluster */
     min_distance = len(centroid - closest_point);
     max_distance = min_distance;
@@ -367,7 +367,7 @@ ccl_device void light_tree_node_importance(KernelGlobals kg,
 
       if (in_volume_segment) {
         const float3 D = N_or_D;
-        const float3 closest_point = P + D * dot(point_to_centroid, D);
+        const float3 closest_point = P + distance * dot(point_to_centroid, D) * D;
         /* minimal distance of the ray to the cluster */
         distance = len(centroid - closest_point);
         point_to_centroid = centroid - P;



More information about the Bf-blender-cvs mailing list