Browse Source

ShaderChunk: Fixed objectspace normalmap

Mr.doob 4 years ago
parent
commit
13b3d6542d
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js

+ 3 - 1
src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.js

@@ -12,7 +12,9 @@ export default /* glsl */`
 
 	#ifdef DOUBLE_SIDED
 
-		normal = normal * ( float( isFrontFacing ) * 2.0 - 1.0 );
+		// We can't compute isFrontFacing if the model doesn't have normals
+
+		normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );
 
 	#endif