我正在使用 Assimp 导入 3d 模型,它为我提供了其法线贴图的切线和双切线,但是我无法弄清楚用于将切线和双切线向量与顶点着色器相乘的矩阵是什么样的 - 是吗WorldViewProjection 矩阵或其他一些特殊用途的“正常矩阵”?
更新:我的顶点着色器
const std::string gVertexShader = "#version 330 \n \
\n \
layout(std140) uniform; \n \
\n \
uniform UnifTransform \n \
{ \n \
mat4 mWVPMatrix; \n \
mat4 mWorldMatrix; \n \
float mTextureTilingFactor; \n \
} Transform; \n \
\n \
layout(location = 0) in vec3 vert_position; \n \
layout(location = 1) in vec3 vert_normal; \n \
layout(location = 2) in vec2 vert_texcoord; \n \
layout(location = 3) in vec3 vert_tangent; \n \
layout(location = 4) in vec3 vert_bitangent; \n \
\n \
out vec3 frag_position; \n \
out vec3 frag_normal; \n \
out vec2 frag_texcoord; \n \
out vec3 frag_tangent; \n \
out vec3 frag_bitangent; \n \
\n \
void main() \n \
{ \n \
gl_Position = Transform.mWVPMatrix * vec4(vert_position, 1.0); \n \
\n \
vec4 position = Transform.mWorldMatrix * vec4(vert_position, 1.0); \n \
vec4 normal = Transform.mWorldMatrix * vec4(vert_normal, 0.0); \n \
vec4 tangent = Transform.mWorldMatrix * vec4(vert_tangent, 0.0); // correct matrix? \n \
vec4 bitangent = Transform.mWorldMatrix * vec4(vert_bitangent, 0.0); \n \
\n \
frag_position = position.xyz; \n \
frag_normal = normal.xyz; \n \
frag_tangent = tangent.xyz; \n \
frag_bitangent = bitangent.xyz; \n \
frag_texcoord = Transform.mTextureTilingFactor * vert_texcoord; \n \