Skip to content

Commit

Permalink
Fix shader error in anisotropy when normal map is missing (#26334)
Browse files Browse the repository at this point in the history
* Fix shader error in physical material anisotropy when normal map is not present.

* Check for USE_ANISOTROPY in uv_pars_vertex.glsl.js
  • Loading branch information
repalash committed Jun 27, 2023
1 parent 406ded4 commit e2ea766
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
10 changes: 9 additions & 1 deletion src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@ float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#else
mat3 tbn = getTangentFrame( - vViewPosition, normal, vNormalMapUv );
mat3 tbn = getTangentFrame( - vViewPosition, normal,
#if defined( USE_NORMALMAP )
vNormalMapUv
#elif defined( USE_CLEARCOAT_NORMALMAP )
vClearcoatNormalMapUv
#else
vUv
#endif
);
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default /* glsl */`
#ifdef USE_UV
#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default /* glsl */`
#ifdef USE_UV
#if defined( USE_UV ) || defined( USE_ANISOTROPY )
varying vec2 vUv;
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/shaders/ShaderChunk/uv_vertex.glsl.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default /* glsl */`
#ifdef USE_UV
#if defined( USE_UV ) || defined( USE_ANISOTROPY )
vUv = vec3( uv, 1 ).xy;
Expand Down

0 comments on commit e2ea766

Please sign in to comment.