Skip to content

Commit

Permalink
Don’t include code using vertex_tangent unless needed (#5176)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
  • Loading branch information
mvaligursky and Martin Valigursky committed Mar 22, 2023
1 parent 6b7dd33 commit eacc336
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
4 changes: 0 additions & 4 deletions src/scene/shader-lib/chunks/lit/vert/tangentBinormal.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,4 @@ vec3 getTangent() {
vec3 getBinormal() {
return cross(vNormalW, vTangentW) * vertex_tangent.w;
}
vec3 getObjectSpaceUp() {
return normalize(dNormalMatrix * vec3(0, 1, 0));
}
`;
3 changes: 1 addition & 2 deletions src/scene/shader-lib/programs/lit-shader.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,7 @@ class LitShader {
codeBody += " vTangentW = getTangent();\n";
codeBody += " vBinormalW = getBinormal();\n";
} else if (options.enableGGXSpecular || !device.extStandardDerivatives) {
code += chunks.tangentBinormalVS;
codeBody += " vObjectSpaceUpW = getObjectSpaceUp();\n";
codeBody += " vObjectSpaceUpW = normalize(dNormalMatrix * vec3(0, 1, 0));\n";
}
}

Expand Down

0 comments on commit eacc336

Please sign in to comment.