@@ -75,30 +75,31 @@ vec4 pbrClearCoat(const Material _mat) {
7575// vec2 pixel = 1.0/RESOLUTION;
7676// ssao = ssao(SCENE_DEPTH, gl_FragCoord.xy*pixel, pixel, 1.);
7777// #endif
78- float diffuseAO = min (_mat.ambientOcclusion, ssao);
79- float specularAO = specularAO(NoV, diffuseAO, _mat.roughness);
8078
8179 // Global Ilumination ( mage Based Lighting )
8280 // ------------------------
8381 vec3 E = envBRDFApprox(specularColor, NoV, _mat.roughness);
8482
85- // This is a bit of a hack to pop the metalics
86- float specIntensity = (2.0 * _mat.metallic) *
87- saturate(- 1.1 + NoV + _mat.metallic) * // Fresnel
88- (_mat.metallic + (.95 - _mat.roughness) * 2.0 ); // make smaller highlights brighter
83+ // // This is a bit of a hack to pop the metalics
84+ // float specIntensity = (2.0 * _mat.metallic) *
85+ // saturate(-1.1 + NoV + _mat.metallic) * // Fresnel
86+ // (_mat.metallic + (.95 - _mat.roughness) * 2.0); // make smaller highlights brighter
8987
88+ float diffAO = min (_mat.ambientOcclusion, ssao);
89+ float specAO = specularAO(NoV, diffAO, _mat.roughness);
9090
9191 vec3 Fr = vec3 (0.0 , 0.0 , 0.0 );
92- Fr = envMap(R, _mat.roughness, _mat.metallic) * E * specIntensity;
92+ Fr = envMap(R, _mat.roughness, _mat.metallic) * E * 2.0 ;
93+ #if ! defined(PLATFORM_RPI)
9394 Fr += tonemap( fresnelReflection(R, f0, NoV) ) * _mat.metallic * (1.0 - _mat.roughness) * 0.2 ;
94- Fr *= specularAO;
95+ #endif
96+ Fr *= specAO;
9597
96- vec3 Fd = vec3 (0.0 , 0.0 , 0.0 );
97- Fd = diffuseColor;
98+ vec3 Fd = diffuseColor;
9899 #if defined(SCENE_SH_ARRAY)
99100 Fd *= tonemap( sphericalHarmonics(N) );
100101 #endif
101- Fd *= diffuseAO ;
102+ Fd *= diffAO ;
102103 Fd *= (1.0 - E);
103104
104105 vec3 Fc = fresnel(f0, clearCoatNoV) * _mat.clearCoat;
@@ -111,8 +112,8 @@ vec4 pbrClearCoat(const Material _mat) {
111112 vec3 clearCoatE = envBRDFApprox(f0, clearCoatNoV, _mat.clearCoatRoughness);
112113 vec3 clearCoatLobe = vec3 (0.0 , 0.0 , 0.0 );
113114 clearCoatLobe += envMap(clearCoatR, _mat.clearCoatRoughness, 1.0 ) * clearCoatE * 3 .;
114- clearCoatLobe += tonemap( fresnelReflection(clearCoatR, f0, clearCoatNoV) ) * (1.0 - _mat.clearCoatRoughness);
115- Fr += clearCoatLobe * (specularAO * _mat.clearCoat);
115+ clearCoatLobe += tonemap( fresnelReflection(clearCoatR, f0, clearCoatNoV) ) * (1.0 - _mat.clearCoatRoughness) * 0.2 ;
116+ Fr += clearCoatLobe * (specAO * _mat.clearCoat);
116117
117118 vec4 color = vec4 (0.0 , 0.0 , 0.0 , 1.0 );
118119 color.rgb += Fd * IBL_LUMINANCE; // Diffuse
@@ -136,8 +137,9 @@ vec4 pbrClearCoat(const Material _mat) {
136137 color.rgb += lightDiffuse; // Diffuse
137138 color.rgb += lightSpecular; // Specular
138139
139- // Clear Coat
140+ // Clear Coat Local ilumination
140141 #if defined(LIGHT_DIRECTION) || defined(LIGHT_POSITION)
142+
141143 #if defined(LIGHT_DIRECTION)
142144 vec3 L = normalize (LIGHT_DIRECTION);
143145 #elif defined(LIGHT_POSITION)
0 commit comments