diff --git a/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js b/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js index 144e3c51aac031..e8631bfa4077d8 100644 --- a/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js +++ b/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.js @@ -10,7 +10,7 @@ export default /* glsl */` #else - clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN ); + clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, gl_FrontFacing ); #endif diff --git a/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js b/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js index 9705dd6a3c8e5c..b55018a46ac973 100644 --- a/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js +++ b/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js @@ -37,7 +37,7 @@ export default /* glsl */` #else - normal = perturbNormal2Arb( -vViewPosition, normal, mapN ); + normal = perturbNormal2Arb( -vViewPosition, normal, mapN, gl_FrontFacing ); #endif diff --git a/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js b/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js index e9134f05412fb6..dcdcb8e0cd4279 100644 --- a/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +++ b/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js @@ -23,7 +23,8 @@ export default /* glsl */` // Per-Pixel Tangent Space Normal Mapping // http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html - vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) { + // param isFrontFacing is Added to fix the directinalLight bug when running on some adreno gpu devices. + vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, bool isFrontFacing) { // Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988 @@ -40,7 +41,7 @@ export default /* glsl */` mat3 tsn = mat3( S, T, N ); - mapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 ); + mapN.xy *= ( float( isFrontFacing ) * 2.0 - 1.0 ); return normalize( tsn * mapN );