Skip to content

Commit 7aad158

Browse files
authored
Merge pull request jMonkeyEngine#2348 from jMonkeyEngine/yaRnMcDonuts-patch-3
Add tbnMat variable to PBRSurface.glsl
2 parents 0d963b6 + 9f6a168 commit 7aad158

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

jme3-core/src/main/resources/Common/ShaderLib/module/PBRSurface.glsl

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
vec3 normal; // normals w/ normalmap
1111
bool frontFacing; //gl_FrontFacing
1212
float depth;
13+
mat3 tbnMat;
1314

1415
// from texture
1516
vec3 albedo;
@@ -36,4 +37,4 @@
3637
#endstruct
3738
#define PBRSurface StdPBRSurface
3839
#endif
39-
#endif
40+
#endif

jme3-core/src/main/resources/Common/ShaderLib/module/pbrlighting/PBRLightingUtils.glsllib

+3-2
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@
266266
#if defined(NORMALMAP) || defined(PARALLAXMAP)
267267
vec3 tan = normalize(wTangent.xyz);
268268
mat3 tbnMat = mat3(tan, wTangent.w * cross( surface.geometryNormal, tan), surface.geometryNormal);
269+
surface.tbnMat = tbnMat;
269270
#endif
270271

271272
vec2 newTexCoord;
@@ -338,7 +339,7 @@
338339
#endif
339340
surface.normal = normalize(tbnMat * normal);
340341
#else
341-
surface.normal = normal;
342+
surface.normal = surface.geometryNormal;
342343
#endif
343344

344345
//spec gloss tex reads:
@@ -589,4 +590,4 @@
589590
#endif
590591

591592

592-
#endif
593+
#endif

0 commit comments

Comments
 (0)