Skip to content

Commit 225bdc7

Browse files
authored
invert TBN, glTF texture transform (playcanvas#3363)
1 parent 12d6687 commit 225bdc7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/graphics/program-lib/chunks/TBNderivative.frag

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ void getTBN() {
1717
// construct a scale-invariant frame
1818
float denom = max( dot(T,T), dot(B,B) );
1919
float invmax = (denom == 0.0) ? 0.0 : 1.0 / sqrt( denom );
20-
dTBN = mat3( T * invmax, B * invmax, dVertexNormalW );
20+
dTBN = mat3( T * invmax, -B * invmax, dVertexNormalW );
2121
}

src/resources/parser/glb-parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ const createMaterial = function (gltfMaterial, textures, disableFlipV) {
975975
// texture coordinate V at load time.
976976
for (map = 0; map < maps.length; ++map) {
977977
material[maps[map] + 'MapTiling'] = new Vec2(scale[0], scale[1]);
978-
material[maps[map] + 'MapOffset'] = new Vec2(offset[0], disableFlipV ? offset[1] : 1.0 - scale[1] - offset[1]);
978+
material[maps[map] + 'MapOffset'] = new Vec2(offset[0], disableFlipV ? 1.0 - scale[1] - offset[1] : offset[1]);
979979
}
980980
};
981981

0 commit comments

Comments
 (0)