Skip to content

Commit dcdae1b

Browse files
committed
add a nan check in cook torrance generate
1 parent 3c26d26 commit dcdae1b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

include/nbl/builtin/hlsl/bxdf/base/cook_torrance_base.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ struct SCookTorrance
204204
localH.z * (VdotH * rcpEta.value[0] + LdotH) - NdotV * rcpEta.value[0], transmitted);
205205
// VNDF sampling guarantees that `VdotH` has same sign as `NdotV`
206206
// and `transmitted` controls the sign of `LdotH` relative to `VdotH` by construction (reflect -> same sign, or refract -> opposite sign)
207-
if (ComputeMicrofacetNormal<scalar_type>::isTransmissionPath(NdotV, NdotL) != transmitted)
207+
if (hlsl::isnan(NdotL) || ComputeMicrofacetNormal<scalar_type>::isTransmissionPath(NdotV, NdotL) != transmitted)
208208
{
209209
valid = false;
210210
return sample_type::createInvalid(); // should check if sample direction is invalid

0 commit comments

Comments
 (0)