@@ -435,6 +435,8 @@ struct SLightSample
435
435
}
436
436
scalar_type getNdotL2 () NBL_CONST_MEMBER_FUNC { return NdotL2; }
437
437
438
+ bool isValid () NBL_CONST_MEMBER_FUNC { return !hlsl::all <vector <bool , 3 > >(hlsl::glsl::equal (L.getDirection (), hlsl::promote<vector3_type>(0.0 ))); }
439
+
438
440
439
441
RayDirInfo L;
440
442
@@ -509,16 +511,17 @@ struct SIsotropicMicrofacetCache
509
511
// always valid because its specialized for the reflective case
510
512
static this_t createForReflection (const scalar_type NdotV, const scalar_type NdotL, const scalar_type VdotL, NBL_REF_ARG (scalar_type) LplusV_rcpLen)
511
513
{
512
- LplusV_rcpLen = rsqrt<scalar_type>(2.0 + 2.0 * VdotL);
514
+ scalar_type unoriented_LplusV_rcpLen = rsqrt<scalar_type>(2.0 + 2.0 * VdotL);
513
515
514
516
this_t retval;
515
517
retval.VdotL = VdotL;
516
- scalar_type NdotLVdotL = NdotL + NdotV;
517
- LplusV_rcpLen = ieee754::flipSign<scalar_type>(LplusV_rcpLen, NdotLVdotL < scalar_type (0.0 ));
518
- retval.VdotH = LplusV_rcpLen * VdotL + LplusV_rcpLen ;
518
+ scalar_type NdotLplusVdotL = NdotL + NdotV;
519
+ scalar_type oriented_LplusV_rcpLen = ieee754::flipSign<scalar_type>(unoriented_LplusV_rcpLen, NdotLplusVdotL < scalar_type (0.0 ));
520
+ retval.VdotH = oriented_LplusV_rcpLen * VdotL + oriented_LplusV_rcpLen ;
519
521
retval.LdotH = retval.VdotH;
520
- retval.absNdotH = NdotLVdotL * LplusV_rcpLen ;
522
+ retval.absNdotH = NdotLplusVdotL * oriented_LplusV_rcpLen ;
521
523
retval.NdotH2 = retval.absNdotH * retval.absNdotH;
524
+ LplusV_rcpLen = oriented_LplusV_rcpLen;
522
525
523
526
return retval;
524
527
}
@@ -976,8 +979,6 @@ NBL_CONCEPT_END(
976
979
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((bxdf.eval (_sample, iso, isocache)), ::nbl::hlsl::is_same_v, typename T::spectral_type))
977
980
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((bxdf.pdf (iso, isocache)), ::nbl::hlsl::is_same_v, typename T::scalar_type))
978
981
((NBL_CONCEPT_REQ_EXPR_RET_TYPE)((bxdf.quotient_and_pdf (_sample, iso, isocache)), ::nbl::hlsl::is_same_v, typename T::quotient_pdf_type))
979
- ((NBL_CONCEPT_REQ_TYPE_ALIAS_CONCEPT)(LightSample, typename T::sample_type))
980
- ((NBL_CONCEPT_REQ_TYPE_ALIAS_CONCEPT)(concepts::FloatingPointLikeVectorial, typename T::spectral_type))
981
982
((NBL_CONCEPT_REQ_TYPE_ALIAS_CONCEPT)(surface_interactions::Isotropic, typename T::isotropic_interaction_type))
982
983
((NBL_CONCEPT_REQ_TYPE_ALIAS_CONCEPT)(CreatableIsotropicMicrofacetCache, typename T::isocache_type))
983
984
);
0 commit comments