aboutsummaryrefslogtreecommitdiff
path: root/engine/src/core-data/Common/ShaderLib/Tangent.glsllib
diff options
context:
space:
mode:
Diffstat (limited to 'engine/src/core-data/Common/ShaderLib/Tangent.glsllib')
-rw-r--r--engine/src/core-data/Common/ShaderLib/Tangent.glsllib11
1 files changed, 11 insertions, 0 deletions
diff --git a/engine/src/core-data/Common/ShaderLib/Tangent.glsllib b/engine/src/core-data/Common/ShaderLib/Tangent.glsllib
new file mode 100644
index 0000000..308c13d
--- /dev/null
+++ b/engine/src/core-data/Common/ShaderLib/Tangent.glsllib
@@ -0,0 +1,11 @@
+uniform mat3 g_NormalMatrix;
+
+void Tangent_ComputeVS(out vec3 outNormal, out vec3 outTangent){
+ outNormal = normalize(g_NormalMatrix * inNormal);
+ outTangent = normalize(g_NormalMatrix * inTangent);
+}
+
+mat3 Tangent_GetBasis(){
+ vec3 wvBinormal = cross(wvNormal, wvTangent);
+ return mat3(wvTangent, wvBinormal, wvNormal);
+}