Commit dfdc9560 authored by Matt Pharr's avatar Matt Pharr

Fix edge case in SpotLight

If there was a zero-sized falloff region, we would very rarely divide
0./0. and get a NaN.
parent d42c4b08
......@@ -65,7 +65,7 @@ Float SpotLight::Falloff(const Vector3f &w) const {
Vector3f wl = Normalize(WorldToLight(w));
Float cosTheta = wl.z;
if (cosTheta < cosTotalWidth) return 0;
if (cosTheta > cosFalloffStart) return 1;
if (cosTheta >= cosFalloffStart) return 1;
// Compute falloff inside spotlight cone
Float delta =
(cosTheta - cosTotalWidth) / (cosFalloffStart - cosTotalWidth);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment