Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default /* glsl */`

#else

clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );
clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, gl_FrontFacing );

#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default /* glsl */`

#else

normal = perturbNormal2Arb( -vViewPosition, normal, mapN );
normal = perturbNormal2Arb( -vViewPosition, normal, mapN, gl_FrontFacing );

#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 );

Expand Down