Skip to content

Hlsl bxdfs 3 #899

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 208 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
208 commits
Select commit Hold shift + click to select a range
34ee35c
some test bxdfs using concepts and templates
keptsecret Nov 25, 2024
f6752c6
some corrections
keptsecret Nov 25, 2024
42fcb2a
anisotropic concept
keptsecret Nov 26, 2024
81e56f4
concepts for existing stuff
keptsecret Nov 26, 2024
1e73953
more templated stuff, new type trait dimensions
keptsecret Nov 27, 2024
6253da8
template conditionalabs
keptsecret Nov 27, 2024
d13cad4
completed adapting functions?
keptsecret Nov 28, 2024
7110c50
added bxdf concept
keptsecret Nov 28, 2024
98a0be1
fresnel function templates
keptsecret Nov 29, 2024
eef66c6
lambertian, oren nayar brdf
keptsecret Nov 29, 2024
eec8486
removed dimensions, extended rank/extent to vectors/matrix
keptsecret Dec 2, 2024
fcadc22
impl geom_smith and ndf funcs
keptsecret Dec 2, 2024
9742aa1
more bxdfs, fix concepts
keptsecret Dec 3, 2024
8433133
restructure existing bxdfs
keptsecret Dec 4, 2024
bafe623
ggx brdf
keptsecret Dec 5, 2024
3ad9f44
some bsdfs
keptsecret Dec 5, 2024
bc13d1f
beckmann bsdf, bug fixes
keptsecret Dec 6, 2024
f56476e
typedefs in concepts
keptsecret Dec 9, 2024
fe7c882
ndfs as structs()
keptsecret Dec 9, 2024
a12d8d1
redid microfacet_to_light_transform as all structs
keptsecret Dec 10, 2024
328c7ea
fixed missing type
keptsecret Dec 10, 2024
aeafa07
changed geom smith to templated structs
keptsecret Dec 10, 2024
91ca79e
adjusted BxDF concept, new impl BxDF structs
keptsecret Dec 11, 2024
3401783
refactored brdfs
keptsecret Dec 11, 2024
3115423
corrected concept macro usage
keptsecret Dec 11, 2024
b244c12
finished beckmann+ggx bsdfs, fixed typos
keptsecret Dec 12, 2024
e8d5aa3
changes for cpp compat
keptsecret Dec 13, 2024
8158aea
Merge branch 'master' into hlsl_bxdfs
keptsecret Dec 13, 2024
d632b3a
moved math functions to tgmath
keptsecret Dec 16, 2024
3df4851
Merge branch 'master' into hlsl_bxdfs
keptsecret Dec 16, 2024
ffaaf87
rsqrt not in stl
keptsecret Dec 16, 2024
aae9a58
update to pr801/803 #1
keptsecret Dec 16, 2024
c3c97e1
funcs use with c++
keptsecret Dec 16, 2024
b308bff
Merge branch 'maths_for_bxdfs_hlsl' into hlsl_bxdfs
keptsecret Dec 16, 2024
2c2b368
hlsl bxdf test example init
keptsecret Dec 17, 2024
67993ad
fixed include
keptsecret Dec 17, 2024
35cd97a
merge fixes from branch
keptsecret Dec 17, 2024
4f230e8
use correct examples
keptsecret Dec 17, 2024
029116f
fixed cpp compat types
keptsecret Dec 17, 2024
aa91c06
some bug fixes
keptsecret Dec 17, 2024
362d8cd
more bug,typo fixes
keptsecret Dec 18, 2024
7734550
fixed bsdf bugs
keptsecret Dec 19, 2024
05ef0e8
merge math fixes and latest example
keptsecret Dec 19, 2024
0abf434
Merge branch 'maths_for_bxdfs_hlsl' into hlsl_bxdfs
keptsecret Dec 20, 2024
2aa51eb
use bit_cast instead of reinterpret_cast
keptsecret Dec 20, 2024
b53c605
fix concepts
keptsecret Dec 20, 2024
16209a8
Merge branch 'maths_for_bxdfs_hlsl' into hlsl_bxdfs
keptsecret Dec 20, 2024
5a3e7e6
fix aniso inter create
keptsecret Dec 20, 2024
cbdb9f6
Merge branch 'maths_for_bxdfs_hlsl' into hlsl_bxdfs
keptsecret Dec 20, 2024
785291d
Merge branch 'maths_for_bxdfs_hlsl' into hlsl_bxdfs
keptsecret Dec 23, 2024
1286459
fixed all? bugs
keptsecret Dec 23, 2024
3616dcf
Merge branch 'maths_for_bxdfs_hlsl' into hlsl_bxdfs
keptsecret Dec 24, 2024
3b78a06
more bug fixes
keptsecret Dec 25, 2024
5bfdf2f
lots more typo fixes
keptsecret Dec 25, 2024
ecdbbf7
final? bxdf concept, bug fixes
keptsecret Dec 26, 2024
ca8905e
update examples merge conflict
keptsecret Jan 3, 2025
9d2a2f3
bug fixes
keptsecret Jan 3, 2025
b83fae6
Merge branch 'maths_for_bxdfs_hlsl' into hlsl_bxdfs
keptsecret Jan 3, 2025
2539b13
use simpler getcolumn method
keptsecret Jan 3, 2025
796c65b
more brdf bug fixes and example update
keptsecret Jan 6, 2025
9ad1be4
bug fixes, microfacet_transform needs rechecking
keptsecret Jan 6, 2025
567875c
bug fixes #2 (I think)
keptsecret Jan 8, 2025
2239a5e
Merge branch 'maths_for_bxdfs_hlsl' into hlsl_bxdfs
keptsecret Jan 8, 2025
6fc78a4
latest example
keptsecret Jan 9, 2025
a4012dc
Merge branch 'maths_for_bxdfs_hlsl' into hlsl_bxdfs
keptsecret Jan 9, 2025
ac23035
uniform sampling, update embed cmakelists
keptsecret Jan 10, 2025
ccaa0a5
fix cmake, include bugs
keptsecret Jan 10, 2025
cf6c5c2
changed ior, spectral_type usage in bxdf + concept
keptsecret Jan 13, 2025
1d3f291
Merge branch 'maths_for_bxdfs_hlsl' into hlsl_bxdfs
keptsecret Jan 14, 2025
d79346b
pcg hash
keptsecret Jan 14, 2025
2217e81
pcg hash in cmakelist
keptsecret Jan 14, 2025
a4fff1c
Merge branch 'maths_for_bxdfs_hlsl' into hlsl_bxdfs
keptsecret Jan 14, 2025
e413e78
fix aniso microfacet cache create bug
keptsecret Jan 15, 2025
8052ada
bug fixes for ggx dielectric, clamp
keptsecret Jan 16, 2025
d176107
calculation fixes
keptsecret Jan 16, 2025
1a1327f
use param structs for eval/quotient_and_pdf funcs
keptsecret Jan 17, 2025
1cedf68
update to latest
keptsecret Jan 20, 2025
bde6e60
some bug fixes
keptsecret Jan 20, 2025
3618e4c
more typo bug fixes
keptsecret Jan 20, 2025
5a00f7d
fix some calculations, ray dir info type
keptsecret Jan 21, 2025
35ded62
fix not reading variables to param struct
keptsecret Jan 22, 2025
7d8e982
duplicate variable bug fix
keptsecret Jan 22, 2025
6e5c569
latest example: chi2
keptsecret Jan 24, 2025
2125aab
fix examples conflict?
keptsecret Jan 24, 2025
a0d356b
update example, conflict
keptsecret Jan 27, 2025
a1d18d3
fix extent/rank type trait definition order
keptsecret Jan 27, 2025
aceb799
fix c++ compile
keptsecret Jan 27, 2025
a0dddce
bxdf traits, bug fixes
keptsecret Jan 29, 2025
772c9b6
latest unit tests
keptsecret Jan 30, 2025
c4de151
latest test #2
keptsecret Jan 30, 2025
d00533a
tack merge example
keptsecret Jan 30, 2025
90e39d1
Merge branch 'new_tgmath' into hlsl_bxdfs_tgmath_premerge
keptsecret Jan 31, 2025
4bf43e3
fixes to get smooth dielectric working
keptsecret Jan 31, 2025
ce0001f
fix merge conflict
keptsecret Feb 3, 2025
edca69a
pcg prng as structs
keptsecret Feb 12, 2025
967ec9e
fix pcg bug
keptsecret Feb 12, 2025
0b4e33a
Merge branch 'hlsl_bxdfs' into hlsl_bxdfs_tgmath_premerge
keptsecret Feb 12, 2025
97a22af
update to master
keptsecret Feb 21, 2025
0497410
Merge branch 'hlsl_bxdfs' into hlsl_bxdfs_tgmath_premerge
keptsecret Feb 21, 2025
18e8437
fix type traits conflict
keptsecret Feb 25, 2025
4c91597
update master, resolve conflicts
keptsecret Feb 25, 2025
de3e5f2
merge in fixes to complete bxdfs
keptsecret Feb 25, 2025
1337646
quick fix for compiling params in dxc
keptsecret Feb 27, 2025
2fe105d
Merge branch 'maths_for_bxdfs_hlsl' into hlsl_bxdfs
keptsecret Feb 27, 2025
d3b3c59
refactor changes to interaction, cache, new fresnel funcs
keptsecret Feb 27, 2025
6ad2965
Merge branch 'maths_for_bxdfs_hlsl' into hlsl_bxdfs
keptsecret Feb 27, 2025
705c4e9
fixes to match new bxdf params
keptsecret Feb 28, 2025
0d4e8ab
Merge branch 'maths_for_bxdfs_hlsl' into hlsl_bxdfs
keptsecret Feb 28, 2025
660b0fc
merge functions.hlsl fixes, resolve conflicts
keptsecret Mar 3, 2025
6fcccfe
fix any/all bugs, typos
keptsecret Mar 3, 2025
d1a37bd
Merge branch 'maths_for_bxdfs_hlsl' into hlsl_bxdfs
keptsecret Mar 4, 2025
dc739aa
Merge branch 'maths_for_bxdfs_hlsl' into hlsl_bxdfs
keptsecret Mar 4, 2025
7953914
Merge branch 'maths_for_bxdfs_hlsl' into hlsl_bxdfs
keptsecret Mar 4, 2025
d31a92b
removed condNegate, use flipSign
keptsecret Mar 4, 2025
721978e
Merge branch 'maths_for_bxdfs_hlsl' into hlsl_bxdfs
keptsecret Mar 4, 2025
78fb433
Merge branch 'maths_for_bxdfs_hlsl' into hlsl_bxdfs
keptsecret Mar 5, 2025
dc9db3e
added concept macro for checking type alias
keptsecret Mar 5, 2025
cc031f6
Merge branch 'master' into hlsl_bxdfs
keptsecret Mar 6, 2025
6ca571e
more bug fixes #6
keptsecret Mar 7, 2025
39a8a9b
minor fixes, infinity use
keptsecret Mar 7, 2025
656b069
Merge branch 'master' into hlsl_bxdfs
keptsecret Mar 10, 2025
b02f8e6
condAbsOrMax in param struct
keptsecret Mar 11, 2025
6662daa
update examples
keptsecret Mar 17, 2025
9712b8d
merge maths branch, fix conflict
keptsecret Mar 19, 2025
8c65555
merge master, fix conflicts
keptsecret Apr 2, 2025
e0ccc9e
some style changes, refactor sampling funcs
keptsecret Apr 2, 2025
b2b7794
new equal func for vectors
keptsecret Apr 2, 2025
e8a9756
Merge branch 'master' into hlsl_bxdfs
keptsecret Apr 2, 2025
bc68c22
refactor fresnel funcs usage
keptsecret Apr 3, 2025
2b8bbbb
getters for interaction, samples
keptsecret Apr 3, 2025
2e368ab
getters for microfacet cache
keptsecret Apr 4, 2025
bd52332
added vector spec for flipSign
keptsecret Apr 4, 2025
bff0aa6
added rng wrapper for 2d/3d uints
keptsecret Apr 4, 2025
deda14a
added OpSelect intrinsic for mix, fix mix behavior with bool
keptsecret Apr 4, 2025
576b814
changes to uniform rand wrapper
keptsecret Apr 14, 2025
268b573
moved quotient_pdf to sampling namespace, split bxdf files
keptsecret Apr 14, 2025
7162a29
fixes to mix, flipSign constraints
keptsecret Apr 14, 2025
540919b
changes to oriented eta, reflect, refract
keptsecret Apr 15, 2025
ac70036
changes to reflectrefract, fresnel funcs
keptsecret Apr 15, 2025
4c7dfa6
change VNDF usage to structs
keptsecret Apr 15, 2025
b982f2c
compute microfacet normals as structs
keptsecret Apr 15, 2025
a0334a0
renamed light sample concept
keptsecret Apr 16, 2025
79ef0d7
changes to microfacet cache member funcs
keptsecret Apr 16, 2025
cc5fab5
added isotropic generate
keptsecret Apr 16, 2025
f99933b
fix surface interaction, microfacet cache concepts + default concepts
keptsecret Apr 16, 2025
f2f9210
minor bug fix
keptsecret Apr 16, 2025
493bc49
minor changes
keptsecret Apr 17, 2025
4b87a4a
renamed some typedefs
keptsecret Apr 17, 2025
31f2af8
moved typedefs, template params dependencies into bxdfs
keptsecret Apr 17, 2025
927ef68
make param struct per bxdf
keptsecret Apr 18, 2025
1cc205d
minor fix to bxdf concepts
keptsecret Apr 18, 2025
688b950
merge mesh_loaders, fix conflicts
keptsecret Jun 25, 2025
f0491a9
update example test
keptsecret Jun 25, 2025
4ac25e5
merge mesh_loaders, fix conflict
keptsecret Jun 26, 2025
5d74015
latest example
keptsecret Jun 26, 2025
d24ac0e
fixed a few typo bugs
keptsecret Jun 27, 2025
6b5b24b
merge master, fix conflict
keptsecret Jul 9, 2025
48816a0
update vulkan headers to match master, not sure why it wasn't
keptsecret Jul 9, 2025
f0e6aea
changes to usage in common.hlsl
keptsecret Jul 10, 2025
64ec358
changes to OrientedEtas, reflect/refract usage
keptsecret Jul 10, 2025
af22570
minor corrections to changes yesterday
keptsecret Jul 11, 2025
21292a7
changes to fresnel structs template requirements
keptsecret Jul 11, 2025
772e6a7
more changes to reflect/refract usage, moved ComputeMicrofacetNormal …
keptsecret Jul 14, 2025
52fb1fc
restructured NDF + geom smith
keptsecret Jul 15, 2025
4987007
change microfacet light measure transform usage
keptsecret Jul 15, 2025
5e3d27a
cast scalar constants to type
keptsecret Jul 15, 2025
675971c
beta and lgamma functions
keptsecret Jul 16, 2025
2e6de67
fix templating and bugs with beta, lgamma
keptsecret Jul 16, 2025
97637f9
use beta function in transmission case for beckmann ndf
keptsecret Jul 16, 2025
3966339
ggx using beta function for transmission
keptsecret Jul 17, 2025
13cc7c3
add casting for ggx ndf
keptsecret Jul 17, 2025
0538049
clean up mix_helper partial specs
keptsecret Jul 18, 2025
d93c194
minor fixes: flipSign_helper, rank, extent
keptsecret Jul 18, 2025
c4fbdd7
merge master, fix conflict
keptsecret Jul 18, 2025
e3a4d8c
additional template partial spec on equal_helper
keptsecret Jul 18, 2025
8bfd9f5
changed sampling header names to reflect working on spheres
keptsecret Jul 18, 2025
dfa787f
quotient_and_pdf only takes vectors now, use vec1 in place of scalar
keptsecret Jul 21, 2025
af82605
minor fixes to mix, equal intrinsics
keptsecret Jul 21, 2025
9b864e2
minor fixes to fresnel stuff
keptsecret Jul 21, 2025
81366a7
some changes to ndf usage
keptsecret Jul 21, 2025
8bd2853
new concept macro to evaluate valid expressions
keptsecret Jul 21, 2025
5630e0e
l2gamma and beta uses faster exp2,log2
keptsecret Jul 22, 2025
e7fcfa3
added threshold checks to lgamma, beta funcs
keptsecret Jul 22, 2025
adf93a4
minor changes to beckmann ndf usage
keptsecret Jul 22, 2025
a1289f1
changes to ggx ndf usage, separate fresnel from vndf
keptsecret Jul 23, 2025
061f7d8
NBL_UNROLL macro
keptsecret Jul 23, 2025
1add8a3
minor changes to sphere sampling, rng usage
keptsecret Jul 23, 2025
9760d71
split diffuse correction factor into own struct
keptsecret Jul 23, 2025
73b0f6d
split out angle adding stuff into new file
keptsecret Jul 23, 2025
80622e3
merge master
keptsecret Jul 24, 2025
4b3fdf2
new mpl find_lsb
keptsecret Jul 24, 2025
dbd2508
beta, l2gamma, lgamma same in c++ and hlsl, some calculation changes
keptsecret Jul 24, 2025
27656c8
moved VdotL into cache from light sample
keptsecret Jul 25, 2025
a36b104
moved square of dot products into bxdf concepts themselves
keptsecret Jul 25, 2025
e63daa4
beckmann ndf funcs take sample, cache and query structs, concepts for…
keptsecret Jul 25, 2025
c4c390e
ggx ndf funcs using query structs, new query concepts
keptsecret Jul 28, 2025
dd1be94
use cache functions: isTransmission, VdotHLdotH
keptsecret Jul 28, 2025
ef2ad00
bxdf specialized beta function
keptsecret Jul 28, 2025
3a81eaf
unified bxdf config struct, used in lambertians, moved bxdf traits af…
keptsecret Jul 29, 2025
3128bd2
use config struct with oren-nayar, smooth dielectric/thin
keptsecret Jul 29, 2025
a5f577a
use config structs in all beckmann, ggx bxdfs
keptsecret Jul 29, 2025
2f1f5fa
Merge branch 'master' into hlsl_bxdfs
keptsecret Jul 30, 2025
2a2bd22
a number of minor fixes
keptsecret Jul 30, 2025
f789621
Merge branch 'hlsl_bxdfs' of github.com:Devsh-Graphics-Programming/Na…
keptsecret Jul 30, 2025
e81cfb4
latest example
keptsecret Jul 30, 2025
0eb30c4
use stirling approx only in bxdf beta func and lancosz for hlsl lgamm…
keptsecret Jul 31, 2025
593fb71
Merge branch 'master' into hlsl_bxdfs
keptsecret Aug 1, 2025
fad651e
various minor fixes, ggx ndf devsh into query
keptsecret Aug 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions include/nbl/builtin/hlsl/bxdf/common.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ NBL_CONCEPT_END(
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((cache.getBdotH()), ::nbl::hlsl::is_same_v, typename T::scalar_type))
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((cache.getBdotH2()), ::nbl::hlsl::is_same_v, typename T::scalar_type))
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((T::createForReflection(V,V)), ::nbl::hlsl::is_same_v, T))
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((T::create(V,V,b0,rcp_eta)), ::nbl::hlsl::is_same_v, T))
// ((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((T::create(V,V,b0,rcp_eta)), ::nbl::hlsl::is_same_v, T)) // TODO: refuses to compile when arg4 is rcp_eta for some reason, eta is fine
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((T::createForReflection(V,V,pNdotL)), ::nbl::hlsl::is_same_v, T))
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((T::template createForReflection<surface_interactions::SAnisotropic<surface_interactions::SIsotropic<ray_dir_info::SBasic<typename T::scalar_type> > >,SLightSample<ray_dir_info::SBasic<typename T::scalar_type> > >(aniso,_sample)), ::nbl::hlsl::is_same_v, T))
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((T::create(V,V,V,V,V,eta,V)), ::nbl::hlsl::is_same_v, T))
Expand Down Expand Up @@ -682,11 +682,11 @@ struct SAnisotropicMicrofacetCache
NBL_CONST_REF_ARG(fresnel::OrientedEtaRcps<monochrome_type>) rcpOrientedEta
)
{
this_t retval = create(tangentSpaceV,tangentSpaceH);
this_t retval = createForReflection(tangentSpaceV,tangentSpaceH);
if (transmitted)
{
const scalar_type VdotH = retval.iso_cache.VdotH;
retval.iso_cache.LdotH = refract_compute_NdotT(VdotH<0.0,VdotH*VdotH,rcpOrientedEta.value2);
Refract<scalar_type> r = Refract<scalar_type>::create(tangentSpaceV, tangentSpaceH);
retval.iso_cache.LdotH = r.getNdotT(rcpOrientedEta.value2[0]);
}

return retval;
Expand Down
10 changes: 4 additions & 6 deletions include/nbl/builtin/hlsl/bxdf/config.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,8 @@ template<class LS, class Interaction, class MicrofacetCache, class Spectrum NBL_
struct SMicrofacetConfiguration;

template<class LS, class Interaction, class MicrofacetCache, class Spectrum>
NBL_PARTIAL_REQ_TOP(LightSample<LS> && surface_interactions::Isotropic<Interaction> && !surface_interactions::Anisotropic<Interaction> &&
CreatableIsotropicMicrofacetCache<MicrofacetCache> && !AnisotropicMicrofacetCache<MicrofacetCache> && concepts::FloatingPointLikeVectorial<Spectrum>)
struct SMicrofacetConfiguration<LS,Interaction,MicrofacetCache,Spectrum NBL_PARTIAL_REQ_BOT(LightSample<LS> && surface_interactions::Isotropic<Interaction> && !surface_interactions::Anisotropic<Interaction> &&
CreatableIsotropicMicrofacetCache<MicrofacetCache> && !AnisotropicMicrofacetCache<MicrofacetCache> && concepts::FloatingPointLikeVectorial<Spectrum>) >
NBL_PARTIAL_REQ_TOP(LightSample<LS> && surface_interactions::Isotropic<Interaction> && !surface_interactions::Anisotropic<Interaction> && CreatableIsotropicMicrofacetCache<MicrofacetCache> && !AnisotropicMicrofacetCache<MicrofacetCache> && concepts::FloatingPointLikeVectorial<Spectrum>)
struct SMicrofacetConfiguration<LS,Interaction,MicrofacetCache,Spectrum NBL_PARTIAL_REQ_BOT(LightSample<LS> && surface_interactions::Isotropic<Interaction> && !surface_interactions::Anisotropic<Interaction> && CreatableIsotropicMicrofacetCache<MicrofacetCache> && !AnisotropicMicrofacetCache<MicrofacetCache> && concepts::FloatingPointLikeVectorial<Spectrum>) >
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a prime site to do

#define COND LightSample<LS> && surface_interactions::Isotropic<Interaction> && !surface_interactions::Anisotropic<Interaction> && \
CreatableIsotropicMicrofacetCache<MicrofacetCache> && !AnisotropicMicrofacetCache<MicrofacetCache> && \
concepts::FloatingPointLikeVectorial<Spectrum>

template<...> NBL_PARTIAL_REQ_TOP(COND)
struct SMicrofacetConfiguration NBL_PARTIAL_REQ_BOTTOM(COND)
#undef COND
{

just to not trip up

{
NBL_CONSTEXPR_STATIC_INLINE bool IsAnisotropic = false;

Expand All @@ -118,12 +116,12 @@ struct SMicrofacetConfiguration<LS,Interaction,MicrofacetCache,Spectrum NBL_PART
using monochrome_type = vector<scalar_type, 1>;

using isotropic_interaction_type = Interaction;
using anisotropic_interaction_type = surface_interactions::SAnisotropic<isotropic_interaction_type>;
using anisotropic_interaction_type = surface_interactions::SAnisotropic<Interaction>;
using sample_type = LS;
using spectral_type = Spectrum;
using quotient_pdf_type = sampling::quotient_and_pdf<spectral_type, scalar_type>;
using isocache_type = MicrofacetCache;
using anisocache_type = SAnisotropicMicrofacetCache<isocache_type>;
using anisocache_type = SAnisotropicMicrofacetCache<MicrofacetCache>;
};

template<class LS, class Interaction, class MicrofacetCache, class Spectrum>
Expand Down
7 changes: 3 additions & 4 deletions include/nbl/builtin/hlsl/bxdf/fresnel.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ struct OrientedEtaRcps
OrientedEtaRcps<T> retval;
const bool backside = NdotI < scalar_type(0.0);
const T rcpEta = hlsl::promote<T>(1.0) / eta;
retval.value = backside ? eta : rcpEta;
retval.value = hlsl::mix(rcpEta, eta, backside);
retval.value2 = retval.value * retval.value;
return retval;
}
Expand All @@ -76,8 +76,8 @@ struct OrientedEtas
OrientedEtas<T> retval;
const bool backside = NdotI < scalar_type(0.0);
const T rcpEta = hlsl::promote<T>(1.0) / eta;
retval.value = backside ? rcpEta : eta;
retval.rcp = backside ? eta : rcpEta;
retval.value = hlsl::mix(eta, rcpEta, backside);
retval.rcp = hlsl::mix(rcpEta, eta, backside);
return retval;
}

Expand Down Expand Up @@ -208,7 +208,6 @@ struct Refract
{
using this_t = Refract<T>;
using vector_type = vector<T, 3>;
using monochrome_type = vector<T, 1>;
using scalar_type = T;

static this_t create(NBL_CONST_REF_ARG(vector_type) I, NBL_CONST_REF_ARG(vector_type) N)
Expand Down
4 changes: 2 additions & 2 deletions include/nbl/builtin/hlsl/bxdf/reflection/beckmann.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ struct SBeckmannIsotropicBxDF
using anisotropic_interaction_type = typename Config::anisotropic_interaction_type;
using sample_type = typename Config::sample_type;
using spectral_type = typename Config::spectral_type;
using quotient_pdf_type = sampling::quotient_and_pdf<spectral_type, scalar_type>;
using quotient_pdf_type = typename Config::quotient_pdf_type;
using isocache_type = typename Config::isocache_type;
using anisocache_type = typename Config::anisocache_type;

Expand Down Expand Up @@ -257,7 +257,7 @@ struct SBeckmannAnisotropicBxDF<Config NBL_PARTIAL_REQ_BOT(config_concepts::Micr
using anisotropic_interaction_type = typename Config::anisotropic_interaction_type;
using sample_type = typename Config::sample_type;
using spectral_type = typename Config::spectral_type;
using quotient_pdf_type = sampling::quotient_and_pdf<spectral_type, scalar_type>;
using quotient_pdf_type = typename Config::quotient_pdf_type;
using isocache_type = typename Config::isocache_type;
using anisocache_type = typename Config::anisocache_type;

Expand Down
2 changes: 1 addition & 1 deletion include/nbl/builtin/hlsl/bxdf/reflection/ggx.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ struct SGGXIsotropicBxDF
using anisotropic_interaction_type = typename Config::anisotropic_interaction_type;
using sample_type = typename Config::sample_type;
using spectral_type = typename Config::spectral_type;
using quotient_pdf_type = sampling::quotient_and_pdf<spectral_type, scalar_type>;
using quotient_pdf_type = typename Config::quotient_pdf_type;
using isocache_type = typename Config::isocache_type;
using anisocache_type = typename Config::anisocache_type;

Expand Down
2 changes: 1 addition & 1 deletion include/nbl/builtin/hlsl/bxdf/reflection/lambertian.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ struct SLambertianBxDF
using anisotropic_interaction_type = typename Config::anisotropic_interaction_type;
using sample_type = typename Config::sample_type;
using spectral_type = typename Config::spectral_type;
using quotient_pdf_type = sampling::quotient_and_pdf<spectral_type, scalar_type>;
using quotient_pdf_type = typename Config::quotient_pdf_type;

using params_isotropic_t = LambertianParams<sample_type, isotropic_interaction_type, scalar_type>;
using params_anisotropic_t = LambertianParams<sample_type, anisotropic_interaction_type, scalar_type>;
Expand Down
2 changes: 1 addition & 1 deletion include/nbl/builtin/hlsl/bxdf/reflection/oren_nayar.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ struct SOrenNayarBxDF
using anisotropic_interaction_type = typename Config::anisotropic_interaction_type;
using sample_type = typename Config::sample_type;
using spectral_type = typename Config::spectral_type;
using quotient_pdf_type = sampling::quotient_and_pdf<spectral_type, scalar_type>;
using quotient_pdf_type = typename Config::quotient_pdf_type;

using params_isotropic_t = OrenNayarParams<sample_type, isotropic_interaction_type, scalar_type>;
using params_anisotropic_t = OrenNayarParams<sample_type, anisotropic_interaction_type, scalar_type>;
Expand Down
2 changes: 1 addition & 1 deletion include/nbl/builtin/hlsl/bxdf/transmission/beckmann.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ struct SBeckmannDielectricIsotropicBxDF
using anisotropic_interaction_type = typename Config::anisotropic_interaction_type;
using sample_type = typename Config::sample_type;
using spectral_type = typename Config::spectral_type;
using quotient_pdf_type = sampling::quotient_and_pdf<spectral_type, scalar_type>;
using quotient_pdf_type = typename Config::quotient_pdf_type;
using isocache_type = typename Config::isocache_type;
using anisocache_type = typename Config::anisocache_type;
using brdf_type = reflection::SBeckmannIsotropicBxDF<Config>;
Expand Down
4 changes: 2 additions & 2 deletions include/nbl/builtin/hlsl/bxdf/transmission/ggx.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ struct SGGXDielectricIsotropicBxDF
using anisotropic_interaction_type = typename Config::anisotropic_interaction_type;
using sample_type = typename Config::sample_type;
using spectral_type = typename Config::spectral_type;
using quotient_pdf_type = sampling::quotient_and_pdf<spectral_type, scalar_type>;
using quotient_pdf_type = typename Config::quotient_pdf_type;
using isocache_type = typename Config::isocache_type;
using anisocache_type = typename Config::anisocache_type;
using brdf_type = reflection::SGGXIsotropicBxDF<Config>;
Expand Down Expand Up @@ -235,7 +235,7 @@ struct SGGXDielectricAnisotropicBxDF<Config NBL_PARTIAL_REQ_BOT(config_concepts:
using anisotropic_interaction_type = typename Config::anisotropic_interaction_type;
using sample_type = typename Config::sample_type;
using spectral_type = typename Config::spectral_type;
using quotient_pdf_type = sampling::quotient_and_pdf<spectral_type, scalar_type>;
using quotient_pdf_type = typename Config::quotient_pdf_type;
using isocache_type = typename Config::isocache_type;
using anisocache_type = typename Config::anisocache_type;
using brdf_type = reflection::SGGXAnisotropicBxDF<Config>;
Expand Down
2 changes: 1 addition & 1 deletion include/nbl/builtin/hlsl/bxdf/transmission/lambertian.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ struct SLambertianBxDF
using anisotropic_interaction_type = typename Config::anisotropic_interaction_type;
using sample_type = typename Config::sample_type;
using spectral_type = typename Config::spectral_type;
using quotient_pdf_type = sampling::quotient_and_pdf<spectral_type, scalar_type>;
using quotient_pdf_type = typename Config::quotient_pdf_type;

using params_isotropic_t = LambertianParams<sample_type, isotropic_interaction_type, scalar_type>;
using params_anisotropic_t = LambertianParams<sample_type, anisotropic_interaction_type, scalar_type>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ struct SSmoothDielectricBxDF
using anisotropic_interaction_type = typename Config::anisotropic_interaction_type;
using sample_type = typename Config::sample_type;
using spectral_type = typename Config::spectral_type;
using quotient_pdf_type = sampling::quotient_and_pdf<spectral_type, scalar_type>;
using quotient_pdf_type = typename Config::quotient_pdf_type;

using params_isotropic_t = SmoothDielectricParams<sample_type, isotropic_interaction_type, scalar_type>;
using params_anisotropic_t = SmoothDielectricParams<sample_type, anisotropic_interaction_type, scalar_type>;
Expand Down Expand Up @@ -201,7 +201,7 @@ struct SSmoothThinDielectricBxDF
using anisotropic_interaction_type = typename Config::anisotropic_interaction_type;
using sample_type = typename Config::sample_type;
using spectral_type = typename Config::spectral_type;
using quotient_pdf_type = sampling::quotient_and_pdf<spectral_type, scalar_type>;
using quotient_pdf_type = typename Config::quotient_pdf_type;

using params_isotropic_t = SmoothDielectricParams<sample_type, isotropic_interaction_type, scalar_type>;
using params_anisotropic_t = SmoothDielectricParams<sample_type, anisotropic_interaction_type, scalar_type>;
Expand Down