[Bf-blender-cvs] [35552c68da6] soc-2022-many-lights-sampling: outline saoh splitting algorithm
Jebbly
noreply at git.blender.org
Fri Jun 10 16:32:58 CEST 2022
Commit: 35552c68da6bb482374760bea94eb1c312b45089
Author: Jebbly
Date: Fri Apr 15 20:03:28 2022 -0500
Branches: soc-2022-many-lights-sampling
https://developer.blender.org/rB35552c68da6bb482374760bea94eb1c312b45089
outline saoh splitting algorithm
===================================================================
M intern/cycles/scene/light_tree.cpp
M intern/cycles/scene/light_tree.h
===================================================================
diff --git a/intern/cycles/scene/light_tree.cpp b/intern/cycles/scene/light_tree.cpp
index c0baa35ab74..8b57c64295d 100644
--- a/intern/cycles/scene/light_tree.cpp
+++ b/intern/cycles/scene/light_tree.cpp
@@ -31,6 +31,7 @@ OrientationBounds merge(const OrientationBounds& cone_a,
float theta_e = fmaxf(a->theta_e, b->theta_e);
/* Return axis and theta_o of a if it already contains b. */
+ /* This should also be called when b is empty. */
if (a->theta_o >= fminf(M_PI_F, theta_d + b->theta_o)) {
return OrientationBounds({a->axis, a->theta_o, theta_e});
}
@@ -186,10 +187,12 @@ void split_saoh(const BoundBox ¢roid_bbox,
BoundBox bbox_L, bbox_R;
OrientationBounds bcone_L, bcone_R;
for (int i = 0; i < num_buckets - 1; i++) {
- bbox_L = BoundBox::empty;
- bbox_R = BoundBox::empty;
energy_L = 0;
energy_R = 0;
+ bbox_L = BoundBox::empty;
+ bbox_R = BoundBox::empty;
+ bcone_L = OrientationBounds::empty;
+ bconee_R = OrientationBounds::empty;
}
}
@@ -197,12 +200,12 @@ void split_saoh(const BoundBox ¢roid_bbox,
float LightTree::calculate_split_cost()
{
- //
+ return 0.0;
}
int LightTree::flatten_tree()
{
-
+ return 1;
}
CCL_NAMESPACE_END
\ No newline at end of file
diff --git a/intern/cycles/scene/light_tree.h b/intern/cycles/scene/light_tree.h
index f5cc4c3762e..446edf80aed 100644
--- a/intern/cycles/scene/light_tree.h
+++ b/intern/cycles/scene/light_tree.h
@@ -23,6 +23,25 @@ struct OrientationBounds {
float theta_o; /* angle bounding the normals */
float theta_e; /* angle bounding the light emissions */
+ __forceinline OrientationBounds()
+ {
+ }
+
+ __forceinline OrientationBounds(const float3 &axis_, float theta_o_, float theta_e_)
+ : axis(axis_), theta_o(theta_o_), theta_e(theta_e_)
+ {
+ }
+
+ enum empty_t { empty = 0 };
+
+ /* If the orientation bound is set to empty, the values are set to minumums
+ * so that merging it with another non-empty orientation bound guarantees that
+ * the return value is equal to non-empty orientation bound. */
+ __forceinline OrientationBounds(empty_t)
+ : axis(make_float3(0, 0, 0)), theta_o(FLT_MIN), theta_e(FLT_MIN)
+ {
+ }
+
float calculate_measure() const;
};
More information about the Bf-blender-cvs
mailing list