|
@@ -236,26 +236,26 @@ vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in m
|
|
|
// End Rect Area Light
|
|
|
|
|
|
// ref: https://www.unrealengine.com/blog/physically-based-shading-on-mobile - environmentBRDF for GGX on mobile
|
|
|
-vec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {
|
|
|
+vec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
|
|
|
|
|
|
float dotNV = saturate( dot( normal, viewDir ) );
|
|
|
|
|
|
vec2 brdf = integrateSpecularBRDF( dotNV, roughness );
|
|
|
|
|
|
- return specularColor * brdf.x + brdf.y;
|
|
|
+ return specularColor * brdf.x + specularF90 * brdf.y;
|
|
|
|
|
|
} // validated
|
|
|
|
|
|
// Fdez-Agüera's "Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting"
|
|
|
// Approximates multiscattering in order to preserve energy.
|
|
|
// http://www.jcgt.org/published/0008/01/03/
|
|
|
-void BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
|
|
|
+void BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
|
|
|
|
|
|
float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
|
|
|
|
|
|
vec2 brdf = integrateSpecularBRDF( dotNV, roughness );
|
|
|
|
|
|
- vec3 FssEss = specularColor * brdf.x + brdf.y;
|
|
|
+ vec3 FssEss = specularColor * brdf.x + specularF90 * brdf.y;
|
|
|
|
|
|
float Ess = brdf.x + brdf.y;
|
|
|
float Ems = 1.0 - Ess;
|