@@ -103,7 +103,7 @@ struct SMicrofacetNormals
103103 const vector3_type local_Np = hlsl::mul (shadingBasis, Np);
104104
105105 const ray_dir_info_type V = interaction.getV ();
106- if (NdotNp <= scalar_type (0.0 ) || (hlsl:: abs (local_Np.x) < numeric_limits<scalar_type>:: min && hlsl:: abs (local_Np.y) < numeric_limits<scalar_type>:: min ))
106+ if (NdotNp > scalar_type (1.0 - 1e- 5 ))
107107 {
108108 typename bxdf_type::isotropic_interaction_type iso = bxdf_type::isotropic_interaction_type::create (V, shadingNormal);
109109 typename bxdf_type::anisotropic_interaction_type interaction_N = bxdf_type::anisotropic_interaction_type::create (iso);
@@ -116,7 +116,7 @@ struct SMicrofacetNormals
116116 const scalar_type NpdotV = interaction.getNdotV ();
117117 const scalar_type NtdotV = hlsl::dot (Nt, V.getDirection ());
118118 spectral_type eval = hlsl::promote<spectral_type>(0.0 );
119-
119+
120120 const vector3_type L = _sample.getL ().getDirection ();
121121 const scalar_type NdotL = hlsl::dot (shadingNormal, L);
122122 const scalar_type NpdotL = _sample.getNdotL (BxDFClampMode::BCM_MAX);
@@ -171,7 +171,7 @@ struct SMicrofacetNormals
171171 _cache.sampleIsShadowed = false ;
172172
173173 const ray_dir_info_type V = interaction.getV ();
174- if (NdotNp <= scalar_type (0.0 ) || (hlsl:: abs (local_Np.x) < numeric_limits<scalar_type>:: min && hlsl:: abs (local_Np.y) < numeric_limits<scalar_type>:: min ))
174+ if (NdotNp > scalar_type (1.0 - 1e- 5 ))
175175 {
176176 typename bxdf_type::isotropic_interaction_type iso = bxdf_type::isotropic_interaction_type::create (V, shadingNormal);
177177 typename bxdf_type::anisotropic_interaction_type interaction_N = bxdf_type::anisotropic_interaction_type::create (iso);
@@ -190,7 +190,7 @@ struct SMicrofacetNormals
190190 s = nested_brdf.generate (interaction, u, _cache.aniso_cache);
191191
192192 if (!s.isValid ())
193- return s ;
193+ return sample_type:: createInvalid () ;
194194
195195 const vector3_type L = s.getL ().getDirection ();
196196 const scalar_type shadowed = G1 (hlsl::max (scalar_type (0.0 ), hlsl::dot (shadingNormal, L)), NdotNp,
@@ -244,7 +244,7 @@ struct SMicrofacetNormals
244244 const vector3_type local_Np = hlsl::mul (shadingBasis, Np);
245245
246246 const ray_dir_info_type V = interaction.getV ();
247- if (NdotNp <= scalar_type (0.0 ) || (hlsl:: abs (local_Np.x) < numeric_limits<scalar_type>:: min && hlsl:: abs (local_Np.y) < numeric_limits<scalar_type>:: min ))
247+ if (NdotNp > scalar_type (1.0 - 1e- 5 ))
248248 {
249249 typename bxdf_type::isotropic_interaction_type iso = bxdf_type::isotropic_interaction_type::create (V, shadingNormal);
250250 typename bxdf_type::anisotropic_interaction_type interaction_N = bxdf_type::anisotropic_interaction_type::create (iso);
@@ -307,7 +307,7 @@ struct SMicrofacetNormals
307307 const vector3_type local_Np = hlsl::mul (shadingBasis, Np);
308308
309309 const ray_dir_info_type V = interaction.getV ();
310- if (NdotNp <= scalar_type (0.0 ) || (hlsl:: abs (local_Np.x) < numeric_limits<scalar_type>:: min && hlsl:: abs (local_Np.y) < numeric_limits<scalar_type>:: min ))
310+ if (NdotNp > scalar_type (1.0 - 1e- 5 ))
311311 {
312312 typename bxdf_type::isotropic_interaction_type iso = bxdf_type::isotropic_interaction_type::create (V, shadingNormal);
313313 typename bxdf_type::anisotropic_interaction_type interaction_N = bxdf_type::anisotropic_interaction_type::create (iso);
0 commit comments