[Bf-blender-cvs] [702a2d075e1] soc-2022-many-lights-sampling: Fix: light tree has artifacts with many lights
Jeffrey Liu
noreply at git.blender.org
Fri Aug 5 06:08:44 CEST 2022
Commit: 702a2d075e141f6c5dfe6ea6a4e29a6a6e8c8d7a
Author: Jeffrey Liu
Date: Fri Aug 5 00:06:19 2022 -0400
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rB702a2d075e141f6c5dfe6ea6a4e29a6a6e8c8d7a
Fix: light tree has artifacts with many lights
This fix resolves artifacts when there are many lights. This is because
it was sampling lights when the total importance was 0.
===================================================================
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 d44ed34cb15..c15e6ebed37 100644
--- a/intern/cycles/kernel/light/light_tree.h
+++ b/intern/cycles/kernel/light/light_tree.h
@@ -372,6 +372,12 @@ ccl_device bool light_tree_sample(KernelGlobals kg,
const float left_importance = light_tree_cluster_importance(kg, P, N, left);
const float right_importance = light_tree_cluster_importance(kg, P, N, right);
+ const float total_importance = left_importance + right_importance;
+
+ if (total_importance == 0.0f) {
+ stack_index--;
+ continue;
+ }
float left_probability = left_importance / (left_importance + right_importance);
if (*randu < left_probability) {
More information about the Bf-blender-cvs
mailing list