Skip to content

Commit 1acf7d6

Browse files
committed
some minor fixes to fresnel orientedEta usage
1 parent ab25c17 commit 1acf7d6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

include/nbl/builtin/hlsl/bxdf/common.hlsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ struct SIsotropicMicrofacetCache
615615

616616
// not coming from the medium (reflected) OR
617617
// exiting at the macro scale AND ( (not L outside the cone of possible directions given IoR with constraint VdotH*LdotH<0.0) OR (microfacet not facing toward the macrosurface, i.e. non heightfield profile of microsurface) )
618-
const bool valid = ComputeMicrofacetNormal<scalar_type>::isValidMicrofacet(transmitted, VdotL, retval.absNdotH, computeMicrofacetNormal.orientedEta);
618+
const bool valid = ComputeMicrofacetNormal<scalar_type>::isValidMicrofacet(transmitted, VdotL, retval.absNdotH, fresnel::OrientedEtas<monochrome_type>::create(1.0, computeMicrofacetNormal.orientedEta));
619619
if (valid)
620620
{
621621
retval.VdotH = hlsl::dot<vector3_type>(computeMicrofacetNormal.V,H);
@@ -638,7 +638,7 @@ struct SIsotropicMicrofacetCache
638638
const bool transmitted = ComputeMicrofacetNormal<scalar_type>::isTransmissionPath(NdotV,NdotL);
639639

640640
ComputeMicrofacetNormal<scalar_type> computeMicrofacetNormal = ComputeMicrofacetNormal<scalar_type>::create(V,L,N,1.0);
641-
computeMicrofacetNormal.orientedEta = orientedEtas;
641+
computeMicrofacetNormal.orientedEta = orientedEtas.value[0];
642642

643643
return create(transmitted, computeMicrofacetNormal, VdotL, N, H);
644644
}
@@ -664,7 +664,7 @@ struct SIsotropicMicrofacetCache
664664
const bool transmitted = ComputeMicrofacetNormal<scalar_type>::isTransmissionPath(interaction.getNdotV(),_sample.getNdotL());
665665

666666
ComputeMicrofacetNormal<scalar_type> computeMicrofacetNormal = ComputeMicrofacetNormal<scalar_type>::create(V,L,N,1.0);
667-
computeMicrofacetNormal.orientedEta = orientedEtas;
667+
computeMicrofacetNormal.orientedEta = orientedEtas.value[0];
668668

669669
return create(transmitted, computeMicrofacetNormal, hlsl::dot<vector3_type>(V, L), N, H);
670670
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ struct ComputeMicrofacetNormal
141141
vector_type unnormalized(const bool _refract)
142142
{
143143
assert(hlsl::dot(V, L) <= -hlsl::min(orientedEta, scalar_type(1.0) / orientedEta));
144-
const scalar_type etaFactor = hlsl::mix(scalar_type(1.0), orientedEta.value, _refract);
144+
const scalar_type etaFactor = hlsl::mix(scalar_type(1.0), orientedEta, _refract);
145145
vector_type tmpH = V + L * etaFactor;
146146
tmpH = ieee754::flipSign<vector_type>(tmpH, _refract && orientedEta > scalar_type(1.0));
147147
return tmpH;

0 commit comments

Comments
 (0)