How to caculate the Inverse-Transpose of a ModelView matrix ?
I've encountered a problem in writting the shader of OpenGL 2.0.
The following is the header of the shader:
attribute highp vec3 inVertex;
attribute highp vec3 inNormal;
attribute highp vec2 inTexCoord;
uniform highp mat4 MVPMatrix;
uniform highp mat4 ModelView;
uniform highp mat3 ModelViewIT;
So, I need to input vertex/normal/uv of the mesh, and the MVP matrix of the mesh in the scene.
And, the "ModelView" uniform is easy to get, it is just:
MdelView matrix = Translation matrix * Rotation matrix.
But, I don't know how to get the "ModelViewIT" uniform.
ModelViewIT means: "Inverse-Transpose of the ModelView matrix".
So could anyone tell me how to calculate it out ? Thanks a lot!
MdelView matrix = Translation * Rotation
Then
MdelView matrixIT = Inverse(Rotation) * Inverse(Translation)
Such that
Identiy = matrix * matrixIT;
Then
MdelView matrixIT = Inverse(Rotation) * Inverse(Translation)
Such that
Identiy = matrix * matrixIT;
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement