@@ -53,7 +53,7 @@ struct SOrenNayar
5353 scalar_type NdotV = interaction.getNdotV (_clamp);
5454 scalar_type C = 1.0 / max <scalar_type>(NdotL, NdotV);
5555
56- scalar_type cos_phi_sin_theta = max <scalar_type>(VdotL - NdotL * NdotV, 0.0 );
56+ scalar_type cos_phi_sin_theta = max <scalar_type>(query. getVdotL () - NdotL * NdotV, 0.0 );
5757 return hlsl::promote<spectral_type>(NdotL * numbers::inv_pi<scalar_type> * 0.5 * (AB.x + AB.y * cos_phi_sin_theta * C));
5858 }
5959 spectral_type eval (NBL_CONST_REF_ARG (sample_type) _sample, NBL_CONST_REF_ARG (isotropic_interaction_type) interaction)
@@ -87,7 +87,13 @@ struct SOrenNayar
8787 quotient_pdf_type __quotient_and_pdf (NBL_CONST_REF_ARG (Query) query, NBL_CONST_REF_ARG (sample_type) _sample, NBL_CONST_REF_ARG (isotropic_interaction_type) interaction)
8888 {
8989 scalar_type _pdf = pdf (_sample);
90- scalar_type q = __rec_pi_factored_out_wo_clamps (query.getVdotL (), _sample.getNdotL (_clamp), interaction.getNdotV (_clamp));
90+
91+ scalar_type NdotL = _sample.getNdotL (_clamp);
92+ scalar_type NdotV = interaction.getNdotV (_clamp);
93+ scalar_type C = 1.0 / max <scalar_type>(NdotL, NdotV);
94+
95+ scalar_type cos_phi_sin_theta = max <scalar_type>(query.getVdotL () - NdotL * NdotV, 0.0 );
96+ scalar_type q = AB.x + AB.y * cos_phi_sin_theta * C;
9197 return quotient_pdf_type::create (q, _pdf);
9298 }
9399 quotient_pdf_type quotient_and_pdf (NBL_CONST_REF_ARG (sample_type) _sample, NBL_CONST_REF_ARG (isotropic_interaction_type) interaction)
0 commit comments