[Bf-blender-cvs] [b9fca048fc6] soc-2022-many-lights-sampling: Fix bounding cone angle not covering the whole sphere
Weizhen Huang
noreply at git.blender.org
Mon Nov 28 23:26:31 CET 2022
Commit: b9fca048fc630874d35a9459685c9a6f12569aa1
Author: Weizhen Huang
Date: Mon Nov 28 23:26:13 2022 +0100
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rBb9fca048fc630874d35a9459685c9a6f12569aa1
Fix bounding cone angle not covering the whole sphere
===================================================================
M intern/cycles/kernel/light/tree.h
===================================================================
diff --git a/intern/cycles/kernel/light/tree.h b/intern/cycles/kernel/light/tree.h
index de3eff956bc..568ce51ce23 100644
--- a/intern/cycles/kernel/light/tree.h
+++ b/intern/cycles/kernel/light/tree.h
@@ -18,6 +18,11 @@ ccl_device float light_tree_cos_bounding_box_angle(const BoundingBox bbox,
const float3 P,
const float3 point_to_centroid)
{
+ if (P.x > bbox.min.x && P.y > bbox.min.y && P.z > bbox.min.z && P.x < bbox.max.x &&
+ P.y < bbox.max.y && P.z < bbox.max.z) {
+ /* If P is inside the bbox, `theta_u` covers the whole sphere */
+ return -1.0f;
+ }
float cos_theta_u = 1.0f;
/* Iterate through all 8 possible points of the bounding box. */
for (int i = 0; i < 8; ++i) {
@@ -362,7 +367,7 @@ ccl_device void light_tree_node_importance(KernelGlobals kg,
return;
}
point_to_centroid = -bcone.axis;
- cos_theta_u = fmaxf(fast_cosf(bcone.theta_o), 0.0f);
+ cos_theta_u = fast_cosf(bcone.theta_o);
distance = 1.0f;
}
else {
More information about the Bf-blender-cvs
mailing list