Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const V_GGX_SmithCorrelated_Anisotropic = /*@__PURE__*/ Fn( ( { alphaT, alphaB,
const gl = dotNV.mul( vec3( alphaT.mul( dotTL ), alphaB.mul( dotBL ), dotNL ).length() );
const v = div( 0.5, gv.add( gl ) );

return v.saturate();
return v;

} ).setLayout( {
name: 'V_GGX_SmithCorrelated_Anisotropic',
Expand Down
2 changes: 1 addition & 1 deletion src/nodes/functions/PhysicalLightingModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ class PhysicalLightingModel extends LightingModel {
// Diffuse energy conservation uses dielectric path
const totalScatteringDielectric = singleScatteringDielectric.add( multiScatteringDielectric );

const diffuse = diffuseContribution.mul( totalScatteringDielectric.r.max( totalScatteringDielectric.g ).max( totalScatteringDielectric.b ).oneMinus() );
const diffuse = diffuseContribution.mul( totalScatteringDielectric.oneMinus() );

const cosineWeightedIrradiance = iblIrradiance.mul( 1 / Math.PI );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,10 @@ vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH )
return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
}

// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2
// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf
// Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
Copy link
Collaborator

Choose a reason for hiding this comment

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

It doesn't seem like this function's implementation has changed, and the previous link gave a specific location in the paper, where the new link is a 60-page document. Perhaps the old link could be kept, or a more specific section of the new paper referenced?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Done! 53e7451

float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {

float a2 = pow2( alpha );

float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );

Expand Down Expand Up @@ -106,7 +104,7 @@ float D_GGX( const in float alpha, const in float dotNH ) {
float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
float v = 0.5 / ( gv + gl );

return saturate(v);
return v;

}

Expand Down Expand Up @@ -463,7 +461,7 @@ vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const
vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; // 1/21

// Multiple scattering contribution
vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg * Favg + EPSILON );
vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );

// Energy compensation factor
float compensationFactor = Ems_V * Ems_L;
Expand Down Expand Up @@ -590,7 +588,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia

// Diffuse energy conservation uses dielectric path
vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
vec3 diffuse = material.diffuseContribution * ( 1.0 - max( max( totalScatteringDielectric.r, totalScatteringDielectric.g ), totalScatteringDielectric.b ) );
vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );

vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;

Expand Down