Skip to content

Commit 3e3589b

Browse files
committed
made smith functions return measureless
1 parent a3733b1 commit 3e3589b

File tree

4 files changed

+22
-44
lines changed

4 files changed

+22
-44
lines changed

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

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,7 @@ template<class Config, class N, class F>
2525
NBL_PARTIAL_REQ_TOP(config_concepts::MicrofacetConfiguration<Config> && ndf::NDF<N> && fresnel::Fresnel<F>)
2626
struct SCookTorrance<Config, N, F, false NBL_PARTIAL_REQ_BOT(config_concepts::MicrofacetConfiguration<Config> && ndf::NDF<N> && fresnel::Fresnel<F>) >
2727
{
28-
NBL_BXDF_CONFIG_ALIAS(scalar_type, Config);
29-
NBL_BXDF_CONFIG_ALIAS(vector2_type, Config);
30-
NBL_BXDF_CONFIG_ALIAS(vector3_type, Config);
31-
NBL_BXDF_CONFIG_ALIAS(ray_dir_info_type, Config);
32-
NBL_BXDF_CONFIG_ALIAS(isotropic_interaction_type, Config);
33-
NBL_BXDF_CONFIG_ALIAS(anisotropic_interaction_type, Config);
34-
NBL_BXDF_CONFIG_ALIAS(sample_type, Config);
35-
NBL_BXDF_CONFIG_ALIAS(spectral_type, Config);
36-
NBL_BXDF_CONFIG_ALIAS(quotient_pdf_type, Config);
37-
NBL_BXDF_CONFIG_ALIAS(isocache_type, Config);
38-
NBL_BXDF_CONFIG_ALIAS(anisocache_type, Config);
28+
MICROFACET_BXDF_CONFIG_TYPE_ALIASES(Config);
3929

4030
using quant_type = typename N::quant_type;
4131

@@ -54,8 +44,7 @@ struct SCookTorrance<Config, N, F, false NBL_PARTIAL_REQ_BOT(config_concepts::Mi
5444
scalar_type DG = D.projectedLightMeasure;
5545
if (any<vector<bool, 2> >(ndf.__base.A > hlsl::promote<vector2_type>(numeric_limits<scalar_type>::min)))
5646
{
57-
quant_type G2 = ndf.template correlated<sample_type, isotropic_interaction_type>(gq, qq, _sample, interaction);
58-
DG *= G2.microfacetMeasure;
47+
DG *= ndf.template correlated<sample_type, isotropic_interaction_type>(gq, _sample, interaction);
5948
}
6049
return fresnel(cache.getVdotH()) * DG;
6150
}
@@ -77,8 +66,7 @@ struct SCookTorrance<Config, N, F, false NBL_PARTIAL_REQ_BOT(config_concepts::Mi
7766
scalar_type DG = D.projectedLightMeasure;
7867
if (any<vector<bool, 2> >(ndf.__base.A > hlsl::promote<vector2_type>(numeric_limits<scalar_type>::min)))
7968
{
80-
quant_type G2 = ndf.template correlated<sample_type, anisotropic_interaction_type>(gq, qq, _sample, interaction);
81-
DG *= G2.microfacetMeasure;
69+
DG *= ndf.template correlated<sample_type, anisotropic_interaction_type>(gq, _sample, interaction);
8270
}
8371
return fresnel(cache.getVdotH()) * DG;
8472
}
@@ -200,8 +188,7 @@ struct SCookTorrance<Config, N, F, true NBL_PARTIAL_REQ_BOT(config_concepts::Mic
200188
scalar_type DG = D.projectedLightMeasure;
201189
if (any<vector<bool, 2> >(ndf.__base.A > hlsl::promote<vector2_type>(numeric_limits<scalar_type>::min)))
202190
{
203-
quant_type G2 = ndf.template correlated<sample_type, isotropic_interaction_type>(gq, qq, _sample, interaction);
204-
DG *= G2.microfacetMeasure;
191+
DG *= ndf.template correlated<sample_type, isotropic_interaction_type>(gq, _sample, interaction);
205192
}
206193
return hlsl::promote<spectral_type>(fresnel(hlsl::abs(cache.getVdotH()))[0]) * DG;
207194
}
@@ -218,8 +205,7 @@ struct SCookTorrance<Config, N, F, true NBL_PARTIAL_REQ_BOT(config_concepts::Mic
218205
scalar_type DG = D.projectedLightMeasure;
219206
if (any<vector<bool, 2> >(ndf.__base.A > hlsl::promote<vector2_type>(numeric_limits<scalar_type>::min)))
220207
{
221-
quant_type G2 = ndf.template correlated<sample_type, anisotropic_interaction_type>(gq, qq, _sample, interaction);
222-
DG *= G2.microfacetMeasure;
208+
DG *= ndf.template correlated<sample_type, anisotropic_interaction_type>(gq, _sample, interaction);
223209
}
224210
return hlsl::promote<spectral_type>(fresnel(hlsl::abs(cache.getVdotH()))[0]) * DG;
225211
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ NBL_CONCEPT_END(
4646
((NBL_CONCEPT_REQ_TYPE)(T::quant_type))
4747
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((ndf.template D<dummy_impl::sample_t, dummy_impl::interaction_t, dummy_impl::cache_t>(quant_query, _sample, interaction, cache)), ::nbl::hlsl::is_same_v, typename T::quant_type))
4848
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((ndf.template DG1<dummy_impl::sample_t, dummy_impl::interaction_t>(dg1_query, quant_query, _sample, interaction)), ::nbl::hlsl::is_same_v, typename T::quant_type))
49-
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((ndf.template correlated<dummy_impl::sample_t, dummy_impl::interaction_t>(g2_query, quant_query, _sample, interaction)), ::nbl::hlsl::is_same_v, typename T::quant_type))
49+
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((ndf.template correlated<dummy_impl::sample_t, dummy_impl::interaction_t>(g2_query, _sample, interaction)), ::nbl::hlsl::is_same_v, typename T::scalar_type))
5050
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((ndf.template G2_over_G1<dummy_impl::sample_t, dummy_impl::interaction_t, dummy_impl::cache_t>(g2_query, _sample, interaction, cache)), ::nbl::hlsl::is_same_v, typename T::scalar_type))
5151
);
5252
#undef g2_query

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

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,9 @@ struct Beckmann<T,false,MTT_REFLECT NBL_PARTIAL_REQ_BOT(concepts::FloatingPointS
337337
}
338338

339339
template<class LS, class Interaction NBL_FUNC_REQUIRES(LightSample<LS> && surface_interactions::Isotropic<Interaction>)
340-
quant_type correlated(NBL_CONST_REF_ARG(g2g1_query_type) query, NBL_CONST_REF_ARG(quant_query_type) quant_query, NBL_CONST_REF_ARG(LS) _sample, NBL_CONST_REF_ARG(Interaction) interaction)
340+
scalar_type correlated(NBL_CONST_REF_ARG(g2g1_query_type) query, NBL_CONST_REF_ARG(LS) _sample, NBL_CONST_REF_ARG(Interaction) interaction)
341341
{
342-
scalar_type g = __base.template correlated<LS, Interaction>(query, _sample, interaction);
343-
return createDualMeasureQuantity<T>(g, interaction.getNdotV(BxDFClampMode::BCM_MAX), _sample.getNdotL(BxDFClampMode::BCM_MAX));
342+
return __base.template correlated<LS, Interaction>(query, _sample, interaction);
344343
}
345344

346345
template<class LS, class Interaction, class MicrofacetCache NBL_FUNC_REQUIRES(LightSample<LS> && surface_interactions::Isotropic<Interaction> && ReadableIsotropicMicrofacetCache<MicrofacetCache>)
@@ -409,10 +408,9 @@ struct Beckmann<T,true,MTT_REFLECT NBL_PARTIAL_REQ_BOT(concepts::FloatingPointSc
409408
}
410409

411410
template<class LS, class Interaction NBL_FUNC_REQUIRES(LightSample<LS> && surface_interactions::Anisotropic<Interaction>)
412-
quant_type correlated(NBL_CONST_REF_ARG(g2g1_query_type) query, NBL_CONST_REF_ARG(quant_query_type) quant_query, NBL_CONST_REF_ARG(LS) _sample, NBL_CONST_REF_ARG(Interaction) interaction)
411+
scalar_type correlated(NBL_CONST_REF_ARG(g2g1_query_type) query, NBL_CONST_REF_ARG(LS) _sample, NBL_CONST_REF_ARG(Interaction) interaction)
413412
{
414-
scalar_type g = __base.template correlated<LS, Interaction>(query, _sample, interaction);
415-
return createDualMeasureQuantity<T>(g, interaction.getNdotV(BxDFClampMode::BCM_MAX), _sample.getNdotL(BxDFClampMode::BCM_MAX));
413+
return __base.template correlated<LS, Interaction>(query, _sample, interaction);
416414
}
417415

418416
template<class LS, class Interaction, class MicrofacetCache NBL_FUNC_REQUIRES(LightSample<LS> && surface_interactions::Anisotropic<Interaction> && AnisotropicMicrofacetCache<MicrofacetCache>)
@@ -484,10 +482,9 @@ struct Beckmann<T,false,reflect_refract NBL_PARTIAL_REQ_BOT(concepts::FloatingPo
484482
}
485483

486484
template<class LS, class Interaction NBL_FUNC_REQUIRES(LightSample<LS> && surface_interactions::Isotropic<Interaction>)
487-
quant_type correlated(NBL_CONST_REF_ARG(g2g1_query_type) query, NBL_CONST_REF_ARG(quant_query_type) quant_query, NBL_CONST_REF_ARG(LS) _sample, NBL_CONST_REF_ARG(Interaction) interaction)
485+
scalar_type correlated(NBL_CONST_REF_ARG(g2g1_query_type) query, NBL_CONST_REF_ARG(LS) _sample, NBL_CONST_REF_ARG(Interaction) interaction)
488486
{
489-
scalar_type g = __base.template correlated<LS, Interaction>(query, _sample, interaction);
490-
return createDualMeasureQuantity<T, reflect_refract>(g, interaction.getNdotV(BxDFClampMode::BCM_ABS), _sample.getNdotL(BxDFClampMode::BCM_ABS), quant_query.getVdotHLdotH(), quant_query.getVdotH_etaLdotH());
487+
return __base.template correlated<LS, Interaction>(query, _sample, interaction);
491488
}
492489

493490
template<class LS, class Interaction, class MicrofacetCache NBL_FUNC_REQUIRES(LightSample<LS> && surface_interactions::Isotropic<Interaction> && ReadableIsotropicMicrofacetCache<MicrofacetCache>)
@@ -558,10 +555,9 @@ struct Beckmann<T,true,reflect_refract NBL_PARTIAL_REQ_BOT(concepts::FloatingPoi
558555
}
559556

560557
template<class LS, class Interaction NBL_FUNC_REQUIRES(LightSample<LS> && surface_interactions::Anisotropic<Interaction>)
561-
quant_type correlated(NBL_CONST_REF_ARG(g2g1_query_type) query, NBL_CONST_REF_ARG(quant_query_type) quant_query, NBL_CONST_REF_ARG(LS) _sample, NBL_CONST_REF_ARG(Interaction) interaction)
558+
scalar_type correlated(NBL_CONST_REF_ARG(g2g1_query_type) query, NBL_CONST_REF_ARG(LS) _sample, NBL_CONST_REF_ARG(Interaction) interaction)
562559
{
563-
scalar_type g = __base.template correlated<LS, Interaction>(query, _sample, interaction);
564-
return createDualMeasureQuantity<T, reflect_refract>(g, interaction.getNdotV(BxDFClampMode::BCM_ABS), _sample.getNdotL(BxDFClampMode::BCM_ABS), quant_query.getVdotHLdotH(), quant_query.getVdotH_etaLdotH());
560+
return __base.template correlated<LS, Interaction>(query, _sample, interaction);
565561
}
566562

567563
template<class LS, class Interaction, class MicrofacetCache NBL_FUNC_REQUIRES(LightSample<LS> && surface_interactions::Anisotropic<Interaction> && AnisotropicMicrofacetCache<MicrofacetCache>)

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

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -347,10 +347,9 @@ struct GGX<T,false,MTT_REFLECT NBL_PARTIAL_REQ_BOT(concepts::FloatingPointScalar
347347
}
348348

349349
template<class LS, class Interaction NBL_FUNC_REQUIRES(LightSample<LS> && surface_interactions::Isotropic<Interaction>)
350-
quant_type correlated(NBL_CONST_REF_ARG(g2g1_query_type) query, NBL_CONST_REF_ARG(quant_query_type) quant_query, NBL_CONST_REF_ARG(LS) _sample, NBL_CONST_REF_ARG(Interaction) interaction)
350+
scalar_type correlated(NBL_CONST_REF_ARG(g2g1_query_type) query, NBL_CONST_REF_ARG(LS) _sample, NBL_CONST_REF_ARG(Interaction) interaction)
351351
{
352-
scalar_type g = __base.template correlated<LS, Interaction>(query, _sample, interaction);
353-
return createDualMeasureQuantity<T>(g, interaction.getNdotV(BxDFClampMode::BCM_MAX), _sample.getNdotL(BxDFClampMode::BCM_MAX));
352+
return __base.template correlated<LS, Interaction>(query, _sample, interaction);
354353
}
355354

356355
template<class LS, class Interaction, class MicrofacetCache NBL_FUNC_REQUIRES(LightSample<LS> && surface_interactions::Isotropic<Interaction> && ReadableIsotropicMicrofacetCache<MicrofacetCache>)
@@ -421,10 +420,9 @@ struct GGX<T,true,MTT_REFLECT NBL_PARTIAL_REQ_BOT(concepts::FloatingPointScalar<
421420
}
422421

423422
template<class LS, class Interaction NBL_FUNC_REQUIRES(LightSample<LS> && surface_interactions::Anisotropic<Interaction>)
424-
quant_type correlated(NBL_CONST_REF_ARG(g2g1_query_type) query, NBL_CONST_REF_ARG(quant_query_type) quant_query, NBL_CONST_REF_ARG(LS) _sample, NBL_CONST_REF_ARG(Interaction) interaction)
423+
scalar_type correlated(NBL_CONST_REF_ARG(g2g1_query_type) query, NBL_CONST_REF_ARG(LS) _sample, NBL_CONST_REF_ARG(Interaction) interaction)
425424
{
426-
scalar_type g = __base.template correlated<LS, Interaction>(query, _sample, interaction);
427-
return createDualMeasureQuantity<T>(g, interaction.getNdotV(BxDFClampMode::BCM_MAX), _sample.getNdotL(BxDFClampMode::BCM_MAX));
425+
return __base.template correlated<LS, Interaction>(query, _sample, interaction);
428426
}
429427

430428
template<class LS, class Interaction, class MicrofacetCache NBL_FUNC_REQUIRES(LightSample<LS> && surface_interactions::Anisotropic<Interaction> && AnisotropicMicrofacetCache<MicrofacetCache>)
@@ -498,10 +496,9 @@ struct GGX<T,false,reflect_refract NBL_PARTIAL_REQ_BOT(concepts::FloatingPointSc
498496
}
499497

500498
template<class LS, class Interaction NBL_FUNC_REQUIRES(LightSample<LS> && surface_interactions::Isotropic<Interaction>)
501-
quant_type correlated(NBL_CONST_REF_ARG(g2g1_query_type) query, NBL_CONST_REF_ARG(quant_query_type) quant_query, NBL_CONST_REF_ARG(LS) _sample, NBL_CONST_REF_ARG(Interaction) interaction)
499+
scalar_type correlated(NBL_CONST_REF_ARG(g2g1_query_type) query, NBL_CONST_REF_ARG(LS) _sample, NBL_CONST_REF_ARG(Interaction) interaction)
502500
{
503-
scalar_type g = __base.template correlated<LS, Interaction>(query, _sample, interaction);
504-
return createDualMeasureQuantity<T, reflect_refract>(g, interaction.getNdotV(BxDFClampMode::BCM_ABS), _sample.getNdotL(BxDFClampMode::BCM_ABS), quant_query.getVdotHLdotH(), quant_query.getVdotH_etaLdotH());
501+
return __base.template correlated<LS, Interaction>(query, _sample, interaction);
505502
}
506503

507504
template<class LS, class Interaction, class MicrofacetCache NBL_FUNC_REQUIRES(LightSample<LS> && surface_interactions::Isotropic<Interaction> && ReadableIsotropicMicrofacetCache<MicrofacetCache>)
@@ -574,10 +571,9 @@ struct GGX<T,true,reflect_refract NBL_PARTIAL_REQ_BOT(concepts::FloatingPointSca
574571
}
575572

576573
template<class LS, class Interaction NBL_FUNC_REQUIRES(LightSample<LS> && surface_interactions::Anisotropic<Interaction>)
577-
quant_type correlated(NBL_CONST_REF_ARG(g2g1_query_type) query, NBL_CONST_REF_ARG(quant_query_type) quant_query, NBL_CONST_REF_ARG(LS) _sample, NBL_CONST_REF_ARG(Interaction) interaction)
574+
scalar_type correlated(NBL_CONST_REF_ARG(g2g1_query_type) query, NBL_CONST_REF_ARG(LS) _sample, NBL_CONST_REF_ARG(Interaction) interaction)
578575
{
579-
scalar_type g = __base.template correlated<LS, Interaction>(query, _sample, interaction);
580-
return createDualMeasureQuantity<T, reflect_refract>(g, interaction.getNdotV(BxDFClampMode::BCM_ABS), _sample.getNdotL(BxDFClampMode::BCM_ABS), quant_query.getVdotHLdotH(), quant_query.getVdotH_etaLdotH());
576+
return __base.template correlated<LS, Interaction>(query, _sample, interaction);
581577
}
582578

583579
template<class LS, class Interaction, class MicrofacetCache NBL_FUNC_REQUIRES(LightSample<LS> && surface_interactions::Anisotropic<Interaction> && AnisotropicMicrofacetCache<MicrofacetCache>)

0 commit comments

Comments
 (0)