|
@@ -58,9 +58,9 @@ float G_GGX_Smith( const in float alpha, const in float dotNL, const in float do
|
|
|
|
|
|
float a2 = alpha * alpha;
|
|
|
|
|
|
- float gl = dotNL + pow( a2 + ( 1.0 - a2 ) * dotNL * dotNL, 0.5 );
|
|
|
+ float gl = dotNL + pow( a2 + ( 1.0 - a2 ) * pow2( dotNL ), 0.5 );
|
|
|
|
|
|
- float gv = dotNV + pow( a2 + ( 1.0 - a2 ) * dotNV * dotNV, 0.5 );
|
|
|
+ float gv = dotNV + pow( a2 + ( 1.0 - a2 ) * pow2( dotNV ), 0.5 );
|
|
|
|
|
|
return 1.0 / ( gl * gv );
|
|
|
|
|
@@ -72,11 +72,11 @@ float G_GGX_Smith( const in float alpha, const in float dotNL, const in float do
|
|
|
// alpha is "roughness squared" in Disney’s reparameterization
|
|
|
float D_GGX( const in float alpha, const in float dotNH ) {
|
|
|
|
|
|
- float a2 = alpha * alpha;
|
|
|
+ float a2 = pow2( alpha );
|
|
|
|
|
|
- float denom = dotNH * dotNH * ( a2 - 1.0 ) + 1.0; // avoid alpha = 0 with dotNH = 1
|
|
|
+ float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; // avoid alpha = 0 with dotNH = 1
|
|
|
|
|
|
- return RECIPROCAL_PI * a2 / ( denom * denom );
|
|
|
+ return RECIPROCAL_PI * a2 / pow2( denom );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -158,7 +158,7 @@ vec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in Ge
|
|
|
|
|
|
// 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 );
|
|
|
+ return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );
|
|
|
}
|
|
|
|
|
|
float BlinnExponentToGGXRoughness( const in float blinnExponent ) {
|