Inverse MV matrix

I’m trying to use the inverse of the modelview matrix, but it doesn’t seem to exist as it did on the vertex program extension.

Am I right? If so, I don’t see a built-in function to invert a matrix neither. Do I have to build my own?

I think so. Our solution was to add it within the scene graph as a uniform to the shader. That way you can get it just as a built in in the shader program. Hopefully this will be revised in later implementations of GLSL.

That’s what I thought. It’s dissapointing the GLSL doesn’t have built-in that are in the vertex program extension, but such is live.

Thanks for the answer.

Try to use gl_NormalMatrix. This should be gl_ModelViewInverseTranspose.

yooyo

Originally posted by yooyo:
Try to use gl_NormalMatrix. This should be gl_ModelViewInverseTranspose.

I’m not sure I understand your answer. gl_ModelViewInverseTranspose doesn’t exist in GLSL. Are you saying gl_NormalMatrix is the same thing than what shoulf be in the transpose of the inverse of the modelview matrix?

gl_NormalMatrix is the upper 3x3 part of the inverse transpose Model View Matrix. This matrix is used for Normal transformation (as the name tells).

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.