Skip to content

Commit 90e479e

Browse files
committed
Clamp to prevent area light artifacts
1 parent 40454c5 commit 90e479e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Assets/ScriptableRenderLoop/ShaderLibrary/AreaLighting.hlsl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ float PolygonRadiance(float4x3 L, bool twoSided)
160160

161161
sum *= INV_TWO_PI; // Normalization
162162

163-
return twoSided ? abs(sum) : max(sum, 0.0);
163+
sum = twoSided ? abs(sum) : max(sum, 0.0);
164+
165+
return isfinite(sum) ? sum : 0.0;
164166
}
165167

166168
// For polygonal lights.

0 commit comments

Comments
 (0)