Skip to content
Merged
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
15 changes: 2 additions & 13 deletions src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,10 @@ export default /* glsl */`
vec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );
vec3 N = normalize( surf_norm );

#ifdef DOUBLE_SIDED

// Workaround for Adreno GPUs gl_FrontFacing bug. See #15850 and #10331

bool frontFacing = dot( cross( S, T ), N ) > 0.0;

mapN.xy *= ( float( frontFacing ) * 2.0 - 1.0 );

#else

mapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );
mat3 tsn = mat3( S, T, N );

#endif
mapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );

mat3 tsn = mat3( S, T, N );
return normalize( tsn * mapN );

}
Expand Down