@@ -20,27 +20,6 @@ namespace bxdf
2020
2121namespace impl
2222{
23- template<typename T, typename U>
24- struct __implicit_promote;
25-
26- template<typename T>
27- struct __implicit_promote<T,T>
28- {
29- static T __call (const T v)
30- {
31- return v;
32- }
33- };
34-
35- template<typename T>
36- struct __implicit_promote<T,vector <typename vector_traits<T>::scalar_type, 1 > >
37- {
38- static T __call (const vector <typename vector_traits<T>::scalar_type, 1 > v)
39- {
40- return hlsl::promote<T>(v[0 ]);
41- }
42- };
43-
4423template<class N, class F, bool IsBSDF>
4524struct quant_query_helper;
4625
@@ -197,16 +176,12 @@ struct SCookTorrance
197176 // allows compiler to throw away calls to ndf.D if using __overwriteDG, before that we only avoid computation for G2(correlated)
198177 if (isInfinity)
199178 return value_weight_type::create (scalar_type (0.0 ), scalar_type (0.0 ));
200-
201- scalar_type clampedVdotH = cache.getVdotH ();
202- NBL_IF_CONSTEXPR (IsBSDF)
203- clampedVdotH = hlsl::abs (clampedVdotH);
204179
205180 spectral_type eval;
206181 NBL_IF_CONSTEXPR (IsBSDF)
207182 eval = pdfQuery.reflectance;
208183 else
209- eval = impl::__implicit_promote<spectral_type, typename fresnel_type::vector_type>:: __call ( _f (clampedVdotH ));
184+ eval = _f (cache. getVdotH ( ));
210185 eval *= DG;
211186
212187 return value_weight_type::create (eval, _pdf);
@@ -383,14 +358,11 @@ struct SCookTorrance
383358 return query;
384359 }
385360
361+ query.pdf = DG1.projectedLightMeasure;
386362 NBL_IF_CONSTEXPR (IsBSDF)
387363 {
388364 query.scaled_reflectance = __getScaledReflectance (query.orientedFresnel, interaction, hlsl::abs (cache.getVdotH ()), cache.isTransmission (), query.reflectance);
389- query.pdf = query.scaled_reflectance * DG1.projectedLightMeasure;
390- }
391- else
392- {
393- query.pdf = DG1.projectedLightMeasure;
365+ query.pdf *= query.scaled_reflectance;
394366 }
395367 }
396368
0 commit comments