Browse Source

use function for roughness to Blinn-Phong exponent with source.

Ben Houston 9 years ago
parent
commit
50655bdf2d

+ 6 - 1
src/renderers/shaders/ShaderChunk/bsdfs.glsl

@@ -146,4 +146,9 @@ vec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in Ge
 
 	return F * ( G * D );
 
-} // validated
+} // validated
+
+// source: http://simonstechblog.blogspot.ca/2011/12/microfacet-brdf.html
+float GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {
+	return ( 2.0 / square( ggxRoughness + 0.0001 ) - 2.0 );
+}

+ 1 - 1
src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl

@@ -32,6 +32,6 @@ void PhysicalMaterial_RE_SpecularIndirectLight( const in vec3 indirectSpecularCo
 
 }
 
-#define Material_BlinnShininessExponent( material )   ( 2.0 / square( material.specularRoughness + 0.0001 ) - 2.0 )
+#define Material_BlinnShininessExponent( material )   GGXRoughnessToBlinnExponent( material.specularRoughness )
 
 #define Material_RE_IndirectSpecularLight    PhysicalMaterial_RE_SpecularIndirectLight