Skip to content

Commit dab9eb5

Browse files
committed
change fresnel usage
1 parent 9b84509 commit dab9eb5

File tree

6 files changed

+46
-89
lines changed

6 files changed

+46
-89
lines changed

include/nbl/builtin/hlsl/bxdf/fresnel.hlsl

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,16 @@ namespace fresnel
304304
#define NBL_CONCEPT_TPLT_PRM_KINDS (typename)
305305
#define NBL_CONCEPT_TPLT_PRM_NAMES (T)
306306
#define NBL_CONCEPT_PARAM_0 (fresnel, T)
307-
NBL_CONCEPT_BEGIN(1)
307+
#define NBL_CONCEPT_PARAM_1 (cosTheta, typename T::scalar_type)
308+
NBL_CONCEPT_BEGIN(2)
308309
#define fresnel NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_0
310+
#define cosTheta NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_1
309311
NBL_CONCEPT_END(
310312
((NBL_CONCEPT_REQ_TYPE)(T::scalar_type))
311313
((NBL_CONCEPT_REQ_TYPE)(T::vector_type))
312-
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((fresnel()), ::nbl::hlsl::is_same_v, typename T::vector_type))
314+
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((fresnel(cosTheta)), ::nbl::hlsl::is_same_v, typename T::vector_type))
313315
);
316+
#undef cosTheta
314317
#undef fresnel
315318
#include <nbl/builtin/hlsl/concepts/__end.hlsl>
316319

@@ -320,15 +323,14 @@ struct Schlick
320323
using scalar_type = typename vector_traits<T>::scalar_type;
321324
using vector_type = T;
322325

323-
static Schlick<T> create(NBL_CONST_REF_ARG(T) F0, scalar_type clampedCosTheta)
326+
static Schlick<T> create(NBL_CONST_REF_ARG(T) F0)
324327
{
325328
Schlick<T> retval;
326329
retval.F0 = F0;
327-
retval.clampedCosTheta = clampedCosTheta;
328330
return retval;
329331
}
330332

331-
T operator()()
333+
T operator()(const scalar_type clampedCosTheta)
332334
{
333335
assert(clampedCosTheta > scalar_type(0.0));
334336
assert(hlsl::all(hlsl::promote<T>(0.02) < F0 && F0 <= hlsl::promote<T>(1.0)));
@@ -337,7 +339,6 @@ struct Schlick
337339
}
338340

339341
T F0;
340-
scalar_type clampedCosTheta;
341342
};
342343

343344
template<typename T NBL_PRIMARY_REQUIRES(concepts::FloatingPointLikeVectorial<T>)
@@ -346,27 +347,25 @@ struct Conductor
346347
using scalar_type = typename vector_traits<T>::scalar_type;
347348
using vector_type = T;
348349

349-
static Conductor<T> create(NBL_CONST_REF_ARG(T) eta, NBL_CONST_REF_ARG(T) etak, scalar_type clampedCosTheta)
350+
static Conductor<T> create(NBL_CONST_REF_ARG(T) eta, NBL_CONST_REF_ARG(T) etak)
350351
{
351352
Conductor<T> retval;
352353
retval.eta = eta;
353354
retval.etak = etak;
354355
retval.etak2 = etak*etak;
355-
retval.clampedCosTheta = clampedCosTheta;
356356
return retval;
357357
}
358358

359-
static Conductor<T> create(NBL_CONST_REF_ARG(complex_t<T>) eta, scalar_type clampedCosTheta)
359+
static Conductor<T> create(NBL_CONST_REF_ARG(complex_t<T>) eta)
360360
{
361361
Conductor<T> retval;
362362
retval.eta = eta.real();
363363
retval.etak = eta.imag();
364364
retval.etak2 = eta.imag()*eta.imag();
365-
retval.clampedCosTheta = clampedCosTheta;
366365
return retval;
367366
}
368367

369-
T operator()()
368+
T operator()(const scalar_type clampedCosTheta)
370369
{
371370
const scalar_type cosTheta2 = clampedCosTheta * clampedCosTheta;
372371
//const float sinTheta2 = 1.0 - cosTheta2;
@@ -387,7 +386,6 @@ struct Conductor
387386
T eta;
388387
T etak;
389388
T etak2;
390-
scalar_type clampedCosTheta;
391389
};
392390

393391
template<typename T NBL_PRIMARY_REQUIRES(concepts::FloatingPointLikeVectorial<T>)
@@ -396,36 +394,33 @@ struct Dielectric
396394
using scalar_type = typename vector_traits<T>::scalar_type;
397395
using vector_type = T;
398396

399-
static Dielectric<T> create(NBL_CONST_REF_ARG(T) eta, scalar_type cosTheta)
397+
static Dielectric<T> create(NBL_CONST_REF_ARG(T) eta)
400398
{
401399
Dielectric<T> retval;
402-
scalar_type absCosTheta = hlsl::abs(cosTheta);
403-
retval.orientedEta = OrientedEtas<T>::create(absCosTheta, eta);
404-
retval.absCosTheta = absCosTheta;
400+
retval.orientedEta = OrientedEtas<T>::create(1.0, eta);
405401
return retval;
406402
}
407403

408-
static T __call(NBL_CONST_REF_ARG(T) orientedEta2, scalar_type absCosTheta)
404+
static T __call(NBL_CONST_REF_ARG(T) orientedEta2, const scalar_type clampedCosTheta)
409405
{
410-
const scalar_type sinTheta2 = 1.0 - absCosTheta * absCosTheta;
406+
const scalar_type sinTheta2 = 1.0 - clampedCosTheta * clampedCosTheta;
411407

412408
// the max() clamping can handle TIR when orientedEta2<1.0
413409
const T t0 = hlsl::sqrt<T>(hlsl::max<T>(orientedEta2 - sinTheta2, hlsl::promote<T>(0.0)));
414-
const T rs = (hlsl::promote<T>(absCosTheta) - t0) / (hlsl::promote<T>(absCosTheta) + t0);
410+
const T rs = (hlsl::promote<T>(clampedCosTheta) - t0) / (hlsl::promote<T>(clampedCosTheta) + t0);
415411

416-
const T t2 = orientedEta2 * absCosTheta;
412+
const T t2 = orientedEta2 * clampedCosTheta;
417413
const T rp = (t0 - t2) / (t0 + t2);
418414

419415
return (rs * rs + rp * rp) * 0.5f;
420416
}
421417

422-
T operator()()
418+
T operator()(const scalar_type clampedCosTheta)
423419
{
424-
return __call(orientedEta.value * orientedEta.value, absCosTheta);
420+
return __call(orientedEta.value * orientedEta.value, clampedCosTheta);
425421
}
426422

427423
OrientedEtas<T> orientedEta;
428-
scalar_type absCosTheta;
429424
};
430425

431426
template<typename T NBL_PRIMARY_REQUIRES(concepts::FloatingPointLikeVectorial<T>)
@@ -434,21 +429,19 @@ struct DielectricFrontFaceOnly
434429
using scalar_type = typename vector_traits<T>::scalar_type;
435430
using vector_type = T;
436431

437-
static DielectricFrontFaceOnly<T> create(NBL_CONST_REF_ARG(T) eta, scalar_type absCosTheta)
432+
static DielectricFrontFaceOnly<T> create(NBL_CONST_REF_ARG(T) eta)
438433
{
439434
Dielectric<T> retval;
440-
retval.orientedEta = OrientedEtas<T>::create(absCosTheta, eta);
441-
retval.absCosTheta = hlsl::abs<T>(absCosTheta);
435+
retval.orientedEta = OrientedEtas<T>::create(1.0, eta);
442436
return retval;
443437
}
444438

445-
T operator()()
439+
T operator()(const scalar_type clampedCosTheta)
446440
{
447-
return Dielectric<T>::__call(orientedEta.value * orientedEta.value, absCosTheta);
441+
return Dielectric<T>::__call(orientedEta.value * orientedEta.value, clampedCosTheta);
448442
}
449443

450444
OrientedEtas<T> orientedEta;
451-
scalar_type absCosTheta;
452445
};
453446

454447

include/nbl/builtin/hlsl/bxdf/ndf.hlsl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace dummy_impl
2121
using sample_t = SLightSample<ray_dir_info::SBasic<float> >;
2222
using interaction_t = surface_interactions::SAnisotropic<surface_interactions::SIsotropic<ray_dir_info::SBasic<float> > >;
2323
using cache_t = SAnisotropicMicrofacetCache<SIsotropicMicrofacetCache<float> >;
24-
struct DQuery // nonsense struct, just put in all the functions to pass the ndf query concepts
24+
struct MetaQuery // nonsense struct, just put in all the functions to pass the ndf query concepts
2525
{
2626
using scalar_type = float;
2727

@@ -41,7 +41,7 @@ struct DQuery // nonsense struct, just put in all the functions to pass the nd
4141
#define NBL_CONCEPT_TPLT_PRM_KINDS (typename)
4242
#define NBL_CONCEPT_TPLT_PRM_NAMES (T)
4343
#define NBL_CONCEPT_PARAM_0 (ndf, T)
44-
#define NBL_CONCEPT_PARAM_1 (query, dummy_impl::DQuery)
44+
#define NBL_CONCEPT_PARAM_1 (query, dummy_impl::MetaQuery)
4545
#define NBL_CONCEPT_PARAM_2 (_sample, dummy_impl::sample_t)
4646
#define NBL_CONCEPT_PARAM_3 (interaction, dummy_impl::interaction_t)
4747
#define NBL_CONCEPT_PARAM_4 (cache, dummy_impl::cache_t)
@@ -54,10 +54,10 @@ NBL_CONCEPT_BEGIN(5)
5454
NBL_CONCEPT_END(
5555
((NBL_CONCEPT_REQ_TYPE)(T::scalar_type))
5656
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((ndf.template D<dummy_impl::cache_t>(cache)), ::nbl::hlsl::is_same_v, typename T::scalar_type))
57-
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((ndf.template DG1<dummy_impl::DQuery>(query)), ::nbl::hlsl::is_same_v, typename T::scalar_type))
58-
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((ndf.template DG1<dummy_impl::DQuery, dummy_impl::cache_t>(query, cache)), ::nbl::hlsl::is_same_v, typename T::scalar_type))
59-
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((ndf.template correlated<dummy_impl::DQuery, dummy_impl::sample_t, dummy_impl::interaction_t>(query, _sample, interaction)), ::nbl::hlsl::is_same_v, typename T::scalar_type))
60-
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((ndf.template G2_over_G1<dummy_impl::DQuery, dummy_impl::sample_t, dummy_impl::interaction_t, dummy_impl::cache_t>(query, _sample, interaction, cache)), ::nbl::hlsl::is_same_v, typename T::scalar_type))
57+
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((ndf.template DG1<dummy_impl::MetaQuery>(query)), ::nbl::hlsl::is_same_v, typename T::scalar_type))
58+
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((ndf.template DG1<dummy_impl::MetaQuery, dummy_impl::cache_t>(query, cache)), ::nbl::hlsl::is_same_v, typename T::scalar_type))
59+
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((ndf.template correlated<dummy_impl::MetaQuery, dummy_impl::sample_t, dummy_impl::interaction_t>(query, _sample, interaction)), ::nbl::hlsl::is_same_v, typename T::scalar_type))
60+
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((ndf.template G2_over_G1<dummy_impl::MetaQuery, dummy_impl::sample_t, dummy_impl::interaction_t, dummy_impl::cache_t>(query, _sample, interaction, cache)), ::nbl::hlsl::is_same_v, typename T::scalar_type))
6161
);
6262
#undef cache
6363
#undef interaction

include/nbl/builtin/hlsl/bxdf/reflection/beckmann.hlsl

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ struct SBeckmannIsotropic
111111
measure_transform_type dualMeasure = __base.template __DG<SBeckmannG2overG1Query>(g2_query, _sample, interaction, cache);
112112
dualMeasure.maxNdotV = interaction.getNdotV(_clamp);
113113
scalar_type DG = dualMeasure.getProjectedLightMeasure();
114-
fresnel_type f = __base.fresnel;
115-
f.clampedCosTheta = cache.getVdotH();
116-
return f() * DG;
114+
return __base.fresnel(cache.getVdotH()) * DG;
117115
}
118116
else
119117
return hlsl::promote<spectral_type>(0.0);
@@ -175,9 +173,7 @@ struct SBeckmannIsotropic
175173
g2_query.lambda_L = query.getLambdaL();
176174
g2_query.lambda_V = query.getLambdaV();
177175
scalar_type G2_over_G1 = beckmann_ndf.template G2_over_G1<SBeckmannG2overG1Query, sample_type, isotropic_interaction_type, isocache_type>(g2_query, _sample, interaction, cache);
178-
fresnel_type f = __base.fresnel;
179-
f.clampedCosTheta = cache.getVdotH();
180-
const spectral_type reflectance = f();
176+
const spectral_type reflectance = __base.fresnel(cache.getVdotH());
181177
quo = reflectance * G2_over_G1;
182178
}
183179

@@ -279,9 +275,7 @@ struct SBeckmannAnisotropic<Config NBL_PARTIAL_REQ_BOT(config_concepts::Microfac
279275
measure_transform_type dualMeasure = __base.template __DG<SBeckmannG2overG1Query>(g2_query, _sample, interaction, cache);
280276
dualMeasure.maxNdotV = interaction.getNdotV(_clamp);
281277
scalar_type DG = dualMeasure.getProjectedLightMeasure();
282-
fresnel_type f = __base.fresnel;
283-
f.clampedCosTheta = cache.getVdotH();
284-
return f() * DG;
278+
return __base.fresnel(cache.getVdotH()) * DG;
285279
}
286280
else
287281
return hlsl::promote<spectral_type>(0.0);
@@ -416,9 +410,7 @@ struct SBeckmannAnisotropic<Config NBL_PARTIAL_REQ_BOT(config_concepts::Microfac
416410
g2_query.lambda_L = query.getLambdaL();
417411
g2_query.lambda_V = query.getLambdaV();
418412
scalar_type G2_over_G1 = beckmann_ndf.template G2_over_G1<SBeckmannG2overG1Query, sample_type, anisotropic_interaction_type, anisocache_type>(g2_query, _sample, interaction, cache);
419-
fresnel_type f = __base.fresnel;
420-
f.clampedCosTheta = cache.getVdotH();
421-
const spectral_type reflectance = f();
413+
const spectral_type reflectance = __base.fresnel(cache.getVdotH());
422414
quo = reflectance * G2_over_G1;
423415
}
424416

include/nbl/builtin/hlsl/bxdf/reflection/ggx.hlsl

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,7 @@ struct SGGXIsotropic
115115
measure_transform_type dualMeasure = __base.template __DG<SGGXG2XQuery>(g2_query, _sample, interaction, cache);
116116
dualMeasure.maxNdotL = _sample.getNdotL(_clamp);
117117
scalar_type DG = dualMeasure.getProjectedLightMeasure();
118-
fresnel_type f = __base.fresnel;
119-
f.clampedCosTheta = cache.getVdotH();
120-
return f() * DG;
118+
return __base.fresnel(cache.getVdotH()) * DG;
121119
}
122120
else
123121
return hlsl::promote<spectral_type>(0.0);
@@ -184,9 +182,7 @@ struct SGGXIsotropic
184182
g2_query._clamp = _clamp;
185183
const scalar_type G2_over_G1 = ggx_ndf.template G2_over_G1<SGGXG2XQuery, sample_type, isotropic_interaction_type, isocache_type>(g2_query, _sample, interaction, cache);
186184

187-
fresnel_type f = __base.fresnel;
188-
f.clampedCosTheta = cache.getVdotH();
189-
const spectral_type reflectance = f();
185+
const spectral_type reflectance = __base.fresnel(cache.getVdotH());
190186
quo = reflectance * G2_over_G1;
191187
}
192188

@@ -292,9 +288,7 @@ struct SGGXAnisotropic<Config NBL_PARTIAL_REQ_BOT(config_concepts::MicrofacetCon
292288
measure_transform_type dualMeasure = __base.template __DG<SGGXG2XQuery>(g2_query, _sample, interaction, cache);
293289
dualMeasure.maxNdotL = _sample.getNdotL(_clamp);
294290
scalar_type DG = dualMeasure.getProjectedLightMeasure();
295-
fresnel_type f = __base.fresnel;
296-
f.clampedCosTheta = cache.getVdotH();
297-
return f() * DG;
291+
return __base.fresnel(cache.getVdotH()) * DG;
298292
}
299293
else
300294
return hlsl::promote<spectral_type>(0.0);
@@ -388,9 +382,7 @@ struct SGGXAnisotropic<Config NBL_PARTIAL_REQ_BOT(config_concepts::MicrofacetCon
388382
g2_query._clamp = BxDFClampMode::BCM_MAX;
389383
const scalar_type G2_over_G1 = ggx_ndf.template G2_over_G1<SGGXG2XQuery, sample_type, anisotropic_interaction_type, anisocache_type>(g2_query, _sample, interaction, cache);
390384

391-
fresnel_type f = __base.fresnel;
392-
f.clampedCosTheta = cache.getVdotH();
393-
const spectral_type reflectance = f();
385+
const spectral_type reflectance = __base.fresnel(cache.getVdotH());
394386
quo = reflectance * G2_over_G1;
395387
}
396388

include/nbl/builtin/hlsl/bxdf/transmission/beckmann.hlsl

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,7 @@ struct SBeckmannDielectricIsotropic
112112
dualMeasure.orientedEta = orientedEta.value[0];
113113
scalar_type DG = dualMeasure.getProjectedLightMeasure();
114114

115-
fresnel_type f = __base.fresnel;
116-
f.absCosTheta = hlsl::abs(cache.getVdotH());
117-
return hlsl::promote<spectral_type>(f()[0]) * DG;
115+
return hlsl::promote<spectral_type>(__base.fresnel(hlsl::abs(cache.getVdotH()))[0]) * DG;
118116
}
119117

120118
sample_type generate(NBL_CONST_REF_ARG(isotropic_interaction_type) interaction, NBL_REF_ARG(vector3_type) u, NBL_REF_ARG(isocache_type) cache)
@@ -139,9 +137,7 @@ struct SBeckmannDielectricIsotropic
139137
scalar_type lambda_V;
140138
};
141139

142-
fresnel_type f = __base.fresnel;
143-
f.absCosTheta = hlsl::abs(cache.getVdotH());
144-
const scalar_type reflectance = f()[0];
140+
const scalar_type reflectance = __base.fresnel(hlsl::abs(cache.getVdotH()))[0];
145141

146142
SBeckmannDG1Query dg1_query;
147143
dg1_query.ndf = __base.__D(cache);
@@ -274,17 +270,13 @@ struct SBeckmannDielectricAnisotropic<Config NBL_PARTIAL_REQ_BOT(config_concepts
274270
dualMeasure.orientedEta = orientedEta.value[0];
275271
scalar_type DG = dualMeasure.getProjectedLightMeasure();
276272

277-
fresnel_type f = __base.fresnel;
278-
f.absCosTheta = hlsl::abs(cache.getVdotH());
279-
return hlsl::promote<spectral_type>(f()[0]) * DG;
273+
return hlsl::promote<spectral_type>(__base.fresnel(hlsl::abs(cache.getVdotH()))[0]) * DG;
280274
}
281275

282276
sample_type __generate_wo_clamps(const vector3_type localV, const vector3_type H, NBL_CONST_REF_ARG(matrix3x3_type) m, NBL_REF_ARG(vector3_type) u, NBL_CONST_REF_ARG(fresnel::OrientedEtaRcps<monochrome_type>) rcpEta, NBL_REF_ARG(anisocache_type) cache)
283277
{
284278
const scalar_type localVdotH = nbl::hlsl::dot<vector3_type>(localV,H);
285-
fresnel_type f = __base.fresnel;
286-
f.absCosTheta = hlsl::abs(localVdotH);
287-
const scalar_type reflectance = f()[0];
279+
const scalar_type reflectance = __base.fresnel(hlsl::abs(cache.getVdotH()))[0];
288280

289281
scalar_type rcpChoiceProb;
290282
bool transmitted = math::partitionRandVariable(reflectance, u.z, rcpChoiceProb);
@@ -337,9 +329,7 @@ struct SBeckmannDielectricAnisotropic<Config NBL_PARTIAL_REQ_BOT(config_concepts
337329
scalar_type lambda_V;
338330
};
339331

340-
fresnel_type f = __base.fresnel;
341-
f.absCosTheta = hlsl::abs(cache.getVdotH());
342-
const scalar_type reflectance = f()[0];
332+
const scalar_type reflectance = __base.fresnel(hlsl::abs(cache.getVdotH()))[0];
343333

344334
SBeckmannDG1Query dg1_query;
345335
dg1_query.ndf = __base.__D(cache);

include/nbl/builtin/hlsl/bxdf/transmission/ggx.hlsl

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,7 @@ struct SGGXDielectricIsotropic
116116
dualMeasure.orientedEta = orientedEta.value[0];
117117
scalar_type DG = dualMeasure.getProjectedLightMeasure();
118118

119-
fresnel_type f = __base.fresnel;
120-
f.absCosTheta = hlsl::abs(cache.getVdotH());
121-
return hlsl::promote<spectral_type>(f()[0]) * DG;
119+
return hlsl::promote<spectral_type>(__base.fresnel(hlsl::abs(cache.getVdotH()))[0]) * DG;
122120
}
123121

124122
sample_type generate(NBL_CONST_REF_ARG(isotropic_interaction_type) interaction, NBL_REF_ARG(vector3_type) u, NBL_REF_ARG(isocache_type) cache)
@@ -149,9 +147,7 @@ struct SGGXDielectricIsotropic
149147
fresnel::OrientedEtas<monochrome_type> orientedEta = __base.fresnel.orientedEta;
150148
dg1_query.orientedEta = orientedEta.value[0];
151149

152-
fresnel_type f = __base.fresnel;
153-
f.absCosTheta = hlsl::abs(cache.getVdotH());
154-
const scalar_type reflectance = f()[0];
150+
const scalar_type reflectance = __base.fresnel(hlsl::abs(cache.getVdotH()))[0];
155151

156152
ndf_type ggx_ndf = __base.ndf;
157153
dg1_query.ndf = __base.__D(cache);
@@ -291,17 +287,13 @@ struct SGGXDielectricAnisotropic<Config NBL_PARTIAL_REQ_BOT(config_concepts::Mic
291287
dualMeasure.orientedEta = orientedEta.value[0];
292288
scalar_type DG = dualMeasure.getProjectedLightMeasure();
293289

294-
fresnel_type f = __base.fresnel;
295-
f.absCosTheta = hlsl::abs(cache.getVdotH());
296-
return hlsl::promote<spectral_type>(f()[0]) * DG;
290+
return hlsl::promote<spectral_type>(__base.fresnel(hlsl::abs(cache.getVdotH()))[0]) * DG;
297291
}
298292

299293
sample_type __generate_wo_clamps(const vector3_type localV, const vector3_type H, NBL_CONST_REF_ARG(matrix3x3_type) m, NBL_REF_ARG(vector3_type) u, NBL_CONST_REF_ARG(fresnel::OrientedEtaRcps<monochrome_type>) rcpEta, NBL_REF_ARG(anisocache_type) cache)
300294
{
301295
const scalar_type localVdotH = nbl::hlsl::dot<vector3_type>(localV,H);
302-
fresnel_type f = __base.fresnel;
303-
f.absCosTheta = hlsl::abs(localVdotH);
304-
const scalar_type reflectance = f()[0];
296+
const scalar_type reflectance = __base.fresnel(hlsl::abs(cache.getVdotH()))[0];
305297

306298
scalar_type rcpChoiceProb;
307299
bool transmitted = math::partitionRandVariable(reflectance, u.z, rcpChoiceProb);
@@ -360,9 +352,7 @@ struct SGGXDielectricAnisotropic<Config NBL_PARTIAL_REQ_BOT(config_concepts::Mic
360352
fresnel::OrientedEtas<monochrome_type> orientedEta = __base.fresnel.orientedEta;
361353
dg1_query.orientedEta = orientedEta.value[0];
362354

363-
fresnel_type f = __base.fresnel;
364-
f.absCosTheta = hlsl::abs(cache.getVdotH());
365-
const scalar_type reflectance = f()[0];
355+
const scalar_type reflectance = __base.fresnel(hlsl::abs(cache.getVdotH()))[0];
366356

367357
ndf_type ggx_ndf = __base.ndf;
368358
dg1_query.ndf = __base.__D(cache);

0 commit comments

Comments
 (0)