瀏覽代碼

invert S, T when the UV direction is backwards

sunag 5 年之前
父節點
當前提交
c7f8f3d1c4

+ 1 - 1
examples/jsm/nodes/misc/NormalMapNode.js

@@ -49,7 +49,7 @@ NormalMapNode.Nodes = ( function () {
 		// Workaround for Adreno GPUs gl_FrontFacing bug. See #15850 and #10331
 		// http://hacksoflife.blogspot.com/2009/11/per-pixel-tangent-space-normal-mapping.html?showComment=1522254677437#c5087545147696715943
 		vec3 NfromST = cross( S, T );
-		if( dot( NfromST, N ) > 0.0 ) {
+		if( dot( NfromST, N ) < 0.0 ) {
 
 			S *= -1.0;
 			T *= -1.0;

+ 1 - 1
src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js

@@ -41,7 +41,7 @@ export default /* glsl */`
 			// Workaround for Adreno GPUs gl_FrontFacing bug. See #15850 and #10331
 			// http://hacksoflife.blogspot.com/2009/11/per-pixel-tangent-space-normal-mapping.html?showComment=1522254677437#c5087545147696715943
 			vec3 NfromST = cross( S, T );
-			if( dot( NfromST, N ) > 0.0 ) {
+			if( dot( NfromST, N ) < 0.0 ) {
 
 				S *= -1.0;
 				T *= -1.0;