Explorar o código

Merge pull request #2817 from bghgary/bumpVertex-fix

Fix math in bumpVertex shader
David Catuhe %!s(int64=8) %!d(string=hai) anos
pai
achega
26358e2d1d
Modificáronse 1 ficheiros con 4 adicións e 4 borrados
  1. 4 4
      src/Shaders/ShadersInclude/bumpVertex.fx

+ 4 - 4
src/Shaders/ShadersInclude/bumpVertex.fx

@@ -1,8 +1,8 @@
 #if defined(BUMP) || defined(PARALLAX)
 	#if defined(TANGENT) && defined(NORMAL)
-		vec3 normalW = normalize(vec3(finalWorld * vec4(normalUpdated, 0.0)));
-		vec3 tangentW = normalize(vec3(finalWorld * vec4(tangentUpdated.xyz, 0.0)));
-		vec3 bitangentW = cross(normalW, tangentW) * tangentUpdated.w;
-		vTBN = mat3(tangentW, bitangentW, normalW);
+		vec3 tbnNormal = normalize(normalUpdated);
+		vec3 tbnTangent = normalize(tangentUpdated.xyz);
+		vec3 tbnBitangent = cross(tbnNormal, tbnTangent) * tangentUpdated.w;
+		vTBN = mat3(finalWorld) * mat3(tbnTangent, tbnBitangent, tbnNormal);
 	#endif
 #endif