Browse Source

Merge pull request #22456 from WestLangley/dev_physical_sheen

MeshPhysicalMaterial: Use roughness-squared in sheen BRDF
WestLangley 3 years ago
parent
commit
2a741efea7
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/renderers/shaders/ShaderChunk/bsdfs.glsl.js

+ 3 - 1
src/renderers/shaders/ShaderChunk/bsdfs.glsl.js

@@ -220,8 +220,10 @@ vec3 BRDF_BlinnPhong( const in IncidentLight incidentLight, const in GeometricCo
 // https://github.com/google/filament/blob/master/shaders/src/brdf.fs
 // https://github.com/google/filament/blob/master/shaders/src/brdf.fs
 float D_Charlie( float roughness, float dotNH ) {
 float D_Charlie( float roughness, float dotNH ) {
 
 
+	float alpha = pow2( roughness );
+
 	// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
 	// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"
-	float invAlpha = 1.0 / roughness;
+	float invAlpha = 1.0 / alpha;
 	float cos2h = dotNH * dotNH;
 	float cos2h = dotNH * dotNH;
 	float sin2h = max( 1.0 - cos2h, 0.0078125 ); // 2^(-14/2), so sin2h^2 > 0 in fp16
 	float sin2h = max( 1.0 - cos2h, 0.0078125 ); // 2^(-14/2), so sin2h^2 > 0 in fp16