Skip to content

Commit ab0aa12

Browse files
committed
fix for nan samples
1 parent 7bd69e9 commit ab0aa12

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

31_HLSLPathTracer/app_resources/hlsl/common.hlsl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,8 @@ struct Shape<PST_RECTANGLE>
588588
if (solidAngle > numeric_limits<float>::min)
589589
{
590590
float32_t3 sph_sample = sphUv[0] * edge0 + sphUv[1] * edge1 + offset;
591-
L = nbl::hlsl::normalize(sph_sample - origin);
591+
L = sph_sample - origin;
592+
L = hlsl::mix<float32_t3>(nbl::hlsl::normalize(L), (float32_t3)0.0, hlsl::abs<float32_t3>(L) > (float32_t3)numeric_limits<float>::min); // TODO? sometimes L is vec3(0), find cause
592593
pdf = 1.f / solidAngle;
593594
}
594595
else

0 commit comments

Comments
 (0)