@@ -71,12 +71,10 @@ vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH )
7171 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
7272}
7373
74- // Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2
75- // https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
74+ // Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
7675float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
7776
7877 float a2 = pow2( alpha );
79-
8078 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
8179 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
8280
@@ -106,7 +104,7 @@ float D_GGX( const in float alpha, const in float dotNH ) {
106104 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
107105 float v = 0.5 / ( gv + gl );
108106
109- return saturate(v) ;
107+ return v ;
110108
111109 }
112110
@@ -463,7 +461,7 @@ vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const
463461 vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; // 1/21
464462
465463 // Multiple scattering contribution
466- vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg * Favg + EPSILON );
464+ vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );
467465
468466 // Energy compensation factor
469467 float compensationFactor = Ems_V * Ems_L;
@@ -590,7 +588,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
590588
591589 // Diffuse energy conservation uses dielectric path
592590 vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
593- vec3 diffuse = material.diffuseContribution * ( 1.0 - max( max( totalScatteringDielectric.r, totalScatteringDielectric.g ), totalScatteringDielectric.b ) );
591+ vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
594592
595593 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
596594
0 commit comments