Skip to content

Commit d6e6e94

Browse files
committed
slight change to bxdf config
1 parent 839ad25 commit d6e6e94

File tree

6 files changed

+51
-56
lines changed

6 files changed

+51
-56
lines changed

include/nbl/builtin/hlsl/bxdf/config.hlsl

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,9 @@ NBL_CONCEPT_END(
4343
NBL_CONCEPT_BEGIN(1)
4444
#define conf NBL_CONCEPT_PARAM_T NBL_CONCEPT_PARAM_0
4545
NBL_CONCEPT_END(
46-
((NBL_CONCEPT_REQ_TYPE)(T::scalar_type))
47-
((NBL_CONCEPT_REQ_TYPE)(T::vector2_type))
48-
((NBL_CONCEPT_REQ_TYPE)(T::vector3_type))
46+
((NBL_CONCEPT_REQ_TYPE_ALIAS_CONCEPT)(BasicConfiguration, T))
4947
((NBL_CONCEPT_REQ_TYPE)(T::monochrome_type))
5048
((NBL_CONCEPT_REQ_TYPE)(T::matrix3x3_type))
51-
((NBL_CONCEPT_REQ_TYPE)(T::ray_dir_info_type))
52-
((NBL_CONCEPT_REQ_TYPE)(T::isotropic_interaction_type))
53-
((NBL_CONCEPT_REQ_TYPE)(T::anisotropic_interaction_type))
54-
((NBL_CONCEPT_REQ_TYPE)(T::sample_type))
55-
((NBL_CONCEPT_REQ_TYPE)(T::spectral_type))
56-
((NBL_CONCEPT_REQ_TYPE)(T::quotient_pdf_type))
5749
((NBL_CONCEPT_REQ_TYPE)(T::isocache_type))
5850
((NBL_CONCEPT_REQ_TYPE)(T::anisocache_type))
5951
);
@@ -64,9 +56,12 @@ NBL_CONCEPT_END(
6456
template<class LS, class Interaction, class Spectrum NBL_STRUCT_CONSTRAINABLE>
6557
struct SConfiguration;
6658

59+
#define CONF_ISO LightSample<LS> && surface_interactions::Isotropic<Interaction> && !surface_interactions::Anisotropic<Interaction> && concepts::FloatingPointLikeVectorial<Spectrum>
60+
6761
template<class LS, class Interaction, class Spectrum>
68-
NBL_PARTIAL_REQ_TOP(LightSample<LS> && surface_interactions::Isotropic<Interaction> && !surface_interactions::Anisotropic<Interaction> && concepts::FloatingPointLikeVectorial<Spectrum>)
69-
struct SConfiguration<LS,Interaction,Spectrum NBL_PARTIAL_REQ_BOT(LightSample<LS> && surface_interactions::Isotropic<Interaction> && !surface_interactions::Anisotropic<Interaction> && concepts::FloatingPointLikeVectorial<Spectrum>) >
62+
NBL_PARTIAL_REQ_TOP(CONF_ISO)
63+
struct SConfiguration<LS,Interaction,Spectrum NBL_PARTIAL_REQ_BOT(CONF_ISO) >
64+
#undef CONF_ISO
7065
{
7166
NBL_CONSTEXPR_STATIC_INLINE bool IsAnisotropic = false;
7267

@@ -83,9 +78,12 @@ struct SConfiguration<LS,Interaction,Spectrum NBL_PARTIAL_REQ_BOT(LightSample<LS
8378
using quotient_pdf_type = sampling::quotient_and_pdf<spectral_type, scalar_type>;
8479
};
8580

81+
#define CONF_ANISO LightSample<LS> && surface_interactions::Anisotropic<Interaction> && concepts::FloatingPointLikeVectorial<Spectrum>
82+
8683
template<class LS, class Interaction, class Spectrum>
87-
NBL_PARTIAL_REQ_TOP(LightSample<LS> && surface_interactions::Anisotropic<Interaction> && concepts::FloatingPointLikeVectorial<Spectrum>)
88-
struct SConfiguration<LS,Interaction,Spectrum NBL_PARTIAL_REQ_BOT(LightSample<LS> && surface_interactions::Anisotropic<Interaction> && concepts::FloatingPointLikeVectorial<Spectrum>) >
84+
NBL_PARTIAL_REQ_TOP(CONF_ANISO)
85+
struct SConfiguration<LS,Interaction,Spectrum NBL_PARTIAL_REQ_BOT(CONF_ANISO) >
86+
#undef CONF_ANISO
8987
{
9088
NBL_CONSTEXPR_STATIC_INLINE bool IsAnisotropic = true;
9189

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,6 @@ struct SCookTorrance
108108
return measure_transform;
109109
}
110110

111-
N getNDF() { return ndf; }
112-
F getFresnel() { return fresnel; }
113-
114111
N ndf;
115112
F fresnel;
116113
};

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ struct SBeckmannIsotropic
8383
query_type createQuery(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(isotropic_interaction_type) interaction)
8484
{
8585
query_type query;
86-
ndf_type beckmann_ndf = __base.getNDF();
86+
ndf_type beckmann_ndf = __base.ndf;
8787
query.lambda_L = beckmann_ndf.LambdaC2(_sample.getNdotL2());
8888
query.lambda_V = beckmann_ndf.LambdaC2(interaction.getNdotV2());
8989
return query;
@@ -111,7 +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.getFresnel();
114+
fresnel_type f = __base.fresnel;
115115
f.clampedCosTheta = cache.getVdotH();
116116
return f() * DG;
117117
}
@@ -141,7 +141,7 @@ struct SBeckmannIsotropic
141141
scalar_type lambda_V;
142142
};
143143

144-
ndf_type beckmann_ndf = __base.getNDF();
144+
ndf_type beckmann_ndf = __base.ndf;
145145

146146
SBeckmannDG1Query dg1_query;
147147
dg1_query.ndf = __base.__D(cache);
@@ -170,12 +170,12 @@ struct SBeckmannIsotropic
170170
scalar_type lambda_V;
171171
};
172172

173-
ndf_type beckmann_ndf = __base.getNDF();
173+
ndf_type beckmann_ndf = __base.ndf;
174174
SBeckmannG2overG1Query g2_query;
175175
g2_query.lambda_L = query.getLambdaL();
176176
g2_query.lambda_V = query.getLambdaV();
177177
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.getFresnel();
178+
fresnel_type f = __base.fresnel;
179179
f.clampedCosTheta = cache.getVdotH();
180180
const spectral_type reflectance = f();
181181
quo = reflectance * G2_over_G1;
@@ -251,7 +251,7 @@ struct SBeckmannAnisotropic<Config NBL_PARTIAL_REQ_BOT(config_concepts::Microfac
251251
query_type createQuery(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(anisotropic_interaction_type) interaction)
252252
{
253253
query_type query;
254-
ndf_type beckmann_ndf = __base.getNDF();
254+
ndf_type beckmann_ndf = __base.ndf;
255255
query.lambda_L = beckmann_ndf.LambdaC2(_sample.getTdotL2(), _sample.getBdotL2(), _sample.getNdotL2());
256256
query.lambda_V = beckmann_ndf.LambdaC2(interaction.getTdotV2(), interaction.getBdotV2(), interaction.getNdotV2());
257257
return query;
@@ -279,7 +279,7 @@ struct SBeckmannAnisotropic<Config NBL_PARTIAL_REQ_BOT(config_concepts::Microfac
279279
measure_transform_type dualMeasure = __base.template __DG<SBeckmannG2overG1Query>(g2_query, _sample, interaction, cache);
280280
dualMeasure.maxNdotV = interaction.getNdotV(_clamp);
281281
scalar_type DG = dualMeasure.getProjectedLightMeasure();
282-
fresnel_type f = __base.getFresnel();
282+
fresnel_type f = __base.fresnel;
283283
f.clampedCosTheta = cache.getVdotH();
284284
return f() * DG;
285285
}
@@ -382,7 +382,7 @@ struct SBeckmannAnisotropic<Config NBL_PARTIAL_REQ_BOT(config_concepts::Microfac
382382
scalar_type lambda_V;
383383
};
384384

385-
ndf_type beckmann_ndf = __base.getNDF();
385+
ndf_type beckmann_ndf = __base.ndf;
386386

387387
SBeckmannDG1Query dg1_query;
388388
dg1_query.ndf = __base.__D(cache);
@@ -411,12 +411,12 @@ struct SBeckmannAnisotropic<Config NBL_PARTIAL_REQ_BOT(config_concepts::Microfac
411411
scalar_type lambda_V;
412412
};
413413

414-
ndf_type beckmann_ndf = __base.getNDF();
414+
ndf_type beckmann_ndf = __base.ndf;
415415
SBeckmannG2overG1Query g2_query;
416416
g2_query.lambda_L = query.getLambdaL();
417417
g2_query.lambda_V = query.getLambdaV();
418418
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.getFresnel();
419+
fresnel_type f = __base.fresnel;
420420
f.clampedCosTheta = cache.getVdotH();
421421
const spectral_type reflectance = f();
422422
quo = reflectance * G2_over_G1;

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ struct SGGXIsotropic
8484
query_type createQuery(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(isotropic_interaction_type) interaction)
8585
{
8686
query_type query;
87-
ndf_type ggx_ndf = __base.getNDF();
87+
ndf_type ggx_ndf = __base.ndf;
8888
query.devsh_v = ggx_ndf.devsh_part(interaction.getNdotV2());
8989
query.devsh_l = ggx_ndf.devsh_part(_sample.getNdotL2());
9090
return query;
@@ -115,7 +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.getFresnel();
118+
fresnel_type f = __base.fresnel;
119119
f.clampedCosTheta = cache.getVdotH();
120120
return f() * DG;
121121
}
@@ -146,7 +146,7 @@ struct SGGXIsotropic
146146
};
147147

148148
SGGXDG1Query dg1_query;
149-
ndf_type ggx_ndf = __base.getNDF();
149+
ndf_type ggx_ndf = __base.ndf;
150150
dg1_query.ndf = __base.__D(cache);
151151

152152
const scalar_type devsh_v = query.getDevshV();
@@ -176,15 +176,15 @@ struct SGGXIsotropic
176176
BxDFClampMode _clamp;
177177
};
178178

179-
ndf_type ggx_ndf = __base.getNDF();
179+
ndf_type ggx_ndf = __base.ndf;
180180

181181
SGGXG2XQuery g2_query;
182182
g2_query.devsh_v = query.getDevshV();
183183
g2_query.devsh_l = query.getDevshL();
184184
g2_query._clamp = _clamp;
185185
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);
186186

187-
fresnel_type f = __base.getFresnel();
187+
fresnel_type f = __base.fresnel;
188188
f.clampedCosTheta = cache.getVdotH();
189189
const spectral_type reflectance = f();
190190
quo = reflectance * G2_over_G1;
@@ -261,7 +261,7 @@ struct SGGXAnisotropic<Config NBL_PARTIAL_REQ_BOT(config_concepts::MicrofacetCon
261261
query_type createQuery(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(anisotropic_interaction_type) interaction)
262262
{
263263
query_type query;
264-
ndf_type ggx_ndf = __base.getNDF();
264+
ndf_type ggx_ndf = __base.ndf;
265265
query.devsh_v = ggx_ndf.devsh_part(interaction.getTdotV2(), interaction.getBdotV2(), interaction.getNdotV2());
266266
query.devsh_l = ggx_ndf.devsh_part(_sample.getTdotL2(), _sample.getBdotL2(), _sample.getNdotL2());
267267
return query;
@@ -292,7 +292,7 @@ struct SGGXAnisotropic<Config NBL_PARTIAL_REQ_BOT(config_concepts::MicrofacetCon
292292
measure_transform_type dualMeasure = __base.template __DG<SGGXG2XQuery>(g2_query, _sample, interaction, cache);
293293
dualMeasure.maxNdotL = _sample.getNdotL(_clamp);
294294
scalar_type DG = dualMeasure.getProjectedLightMeasure();
295-
fresnel_type f = __base.getFresnel();
295+
fresnel_type f = __base.fresnel;
296296
f.clampedCosTheta = cache.getVdotH();
297297
return f() * DG;
298298
}
@@ -350,7 +350,7 @@ struct SGGXAnisotropic<Config NBL_PARTIAL_REQ_BOT(config_concepts::MicrofacetCon
350350
};
351351

352352
SGGXDG1Query dg1_query;
353-
ndf_type ggx_ndf = __base.getNDF();
353+
ndf_type ggx_ndf = __base.ndf;
354354
dg1_query.ndf = __base.__D(cache);
355355

356356
const scalar_type devsh_v = query.getDevshV();
@@ -380,15 +380,15 @@ struct SGGXAnisotropic<Config NBL_PARTIAL_REQ_BOT(config_concepts::MicrofacetCon
380380
BxDFClampMode _clamp;
381381
};
382382

383-
ndf_type ggx_ndf = __base.getNDF();
383+
ndf_type ggx_ndf = __base.ndf;
384384

385385
SGGXG2XQuery g2_query;
386386
g2_query.devsh_v = query.getDevshV();
387387
g2_query.devsh_l = query.getDevshL();
388388
g2_query._clamp = BxDFClampMode::BCM_MAX;
389389
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);
390390

391-
fresnel_type f = __base.getFresnel();
391+
fresnel_type f = __base.fresnel;
392392
f.clampedCosTheta = cache.getVdotH();
393393
const spectral_type reflectance = f();
394394
quo = reflectance * G2_over_G1;

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ struct SBeckmannDielectricIsotropic
8383
query_type createQuery(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(isotropic_interaction_type) interaction)
8484
{
8585
query_type query;
86-
ndf_type beckmann_ndf = __base.getNDF();
86+
ndf_type beckmann_ndf = __base.ndf;
8787
query.lambda_L = beckmann_ndf.LambdaC2(_sample.getNdotL2());
8888
query.lambda_V = beckmann_ndf.LambdaC2(interaction.getNdotV2());
8989
return query;
@@ -112,7 +112,7 @@ struct SBeckmannDielectricIsotropic
112112
dualMeasure.orientedEta = orientedEta.value[0];
113113
scalar_type DG = dualMeasure.getProjectedLightMeasure();
114114

115-
fresnel_type f = __base.getFresnel();
115+
fresnel_type f = __base.fresnel;
116116
f.absCosTheta = hlsl::abs(cache.getVdotH());
117117
return hlsl::promote<spectral_type>(f()[0]) * DG;
118118
}
@@ -139,7 +139,7 @@ struct SBeckmannDielectricIsotropic
139139
scalar_type lambda_V;
140140
};
141141

142-
fresnel_type f = __base.getFresnel();
142+
fresnel_type f = __base.fresnel;
143143
f.absCosTheta = hlsl::abs(cache.getVdotH());
144144
const scalar_type reflectance = f()[0];
145145

@@ -169,7 +169,7 @@ struct SBeckmannDielectricIsotropic
169169
scalar_type lambda_V;
170170
};
171171

172-
ndf_type beckmann_ndf = __base.getNDF();
172+
ndf_type beckmann_ndf = __base.ndf;
173173
SBeckmannG2overG1Query g2_query;
174174
g2_query.lambda_L = query.getLambdaL();
175175
g2_query.lambda_V = query.getLambdaV();
@@ -245,7 +245,7 @@ struct SBeckmannDielectricAnisotropic<Config NBL_PARTIAL_REQ_BOT(config_concepts
245245
query_type createQuery(NBL_CONST_REF_ARG(sample_type) _sample, NBL_CONST_REF_ARG(anisotropic_interaction_type) interaction)
246246
{
247247
query_type query;
248-
ndf_type beckmann_ndf = __base.getNDF();
248+
ndf_type beckmann_ndf = __base.ndf;
249249
query.lambda_L = beckmann_ndf.LambdaC2(_sample.getTdotL2(), _sample.getBdotL2(), _sample.getNdotL2());
250250
query.lambda_V = beckmann_ndf.LambdaC2(interaction.getTdotV2(), interaction.getBdotV2(), interaction.getNdotV2());
251251
return query;
@@ -274,15 +274,15 @@ struct SBeckmannDielectricAnisotropic<Config NBL_PARTIAL_REQ_BOT(config_concepts
274274
dualMeasure.orientedEta = orientedEta.value[0];
275275
scalar_type DG = dualMeasure.getProjectedLightMeasure();
276276

277-
fresnel_type f = __base.getFresnel();
277+
fresnel_type f = __base.fresnel;
278278
f.absCosTheta = hlsl::abs(cache.getVdotH());
279279
return hlsl::promote<spectral_type>(f()[0]) * DG;
280280
}
281281

282282
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)
283283
{
284284
const scalar_type localVdotH = nbl::hlsl::dot<vector3_type>(localV,H);
285-
fresnel_type f = __base.getFresnel();
285+
fresnel_type f = __base.fresnel;
286286
f.absCosTheta = hlsl::abs(localVdotH);
287287
const scalar_type reflectance = f()[0];
288288

@@ -337,7 +337,7 @@ struct SBeckmannDielectricAnisotropic<Config NBL_PARTIAL_REQ_BOT(config_concepts
337337
scalar_type lambda_V;
338338
};
339339

340-
fresnel_type f = __base.getFresnel();
340+
fresnel_type f = __base.fresnel;
341341
f.absCosTheta = hlsl::abs(cache.getVdotH());
342342
const scalar_type reflectance = f()[0];
343343

@@ -367,7 +367,7 @@ struct SBeckmannDielectricAnisotropic<Config NBL_PARTIAL_REQ_BOT(config_concepts
367367
scalar_type lambda_V;
368368
};
369369

370-
ndf_type beckmann_ndf = __base.getNDF();
370+
ndf_type beckmann_ndf = __base.ndf;
371371
SBeckmannG2overG1Query g2_query;
372372
g2_query.lambda_L = query.getLambdaL();
373373
g2_query.lambda_V = query.getLambdaV();

0 commit comments

Comments
 (0)