diff --git a/jme3-core/src/main/resources/Common/ShaderLib/module/PBRSurface.glsl b/jme3-core/src/main/resources/Common/ShaderLib/module/PBRSurface.glsl index d8105ed543..6394049364 100644 --- a/jme3-core/src/main/resources/Common/ShaderLib/module/PBRSurface.glsl +++ b/jme3-core/src/main/resources/Common/ShaderLib/module/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 \ No newline at end of file +#endif diff --git a/jme3-core/src/main/resources/Common/ShaderLib/module/pbrlighting/PBRLightingUtils.glsllib b/jme3-core/src/main/resources/Common/ShaderLib/module/pbrlighting/PBRLightingUtils.glsllib index e987993fa1..79cb9ea37a 100644 --- a/jme3-core/src/main/resources/Common/ShaderLib/module/pbrlighting/PBRLightingUtils.glsllib +++ b/jme3-core/src/main/resources/Common/ShaderLib/module/pbrlighting/PBRLightingUtils.glsllib @@ -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; #endif vec2 newTexCoord; @@ -338,7 +339,7 @@ #endif surface.normal = normalize(tbnMat * normal); #else - surface.normal = normal; + surface.normal = surface.geometryNormal; #endif //spec gloss tex reads: @@ -589,4 +590,4 @@ #endif -#endif \ No newline at end of file +#endif