Add tbnMat variable to PBRSurface.glsl
@@ -10,6 +10,7 @@
vec3 normal; // normals w/ normalmap
bool frontFacing; //gl_FrontFacing
float depth;
+ mat3 tbnMat;
// from texture
vec3 albedo;
@@ -36,4 +37,4 @@
#endstruct
#define PBRSurface StdPBRSurface
#endif
-#endif
+#endif
@@ -266,6 +266,7 @@
#if defined(NORMALMAP) || defined(PARALLAXMAP)
vec3 tan = normalize(wTangent.xyz);
mat3 tbnMat = mat3(tan, wTangent.w * cross( surface.geometryNormal, tan), surface.geometryNormal);
+ surface.tbnMat = tbnMat;
vec2 newTexCoord;
@@ -338,7 +339,7 @@
surface.normal = normalize(tbnMat * normal);
#else
- surface.normal = normal;
+ surface.normal = surface.geometryNormal;
//spec gloss tex reads:
@@ -589,4 +590,4 @@