PDA

View Full Version : inverse MV matrix



vince
05-17-2004, 09:44 AM
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?

ToolTech
05-17-2004, 09:54 AM
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.

vince
05-17-2004, 09:58 AM
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.

yooyo
05-18-2004, 09:15 AM
Try to use gl_NormalMatrix. This should be gl_ModelViewInverseTranspose.

yooyo

vince
05-18-2004, 09:27 AM
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?

Corrail
05-18-2004, 09:49 AM
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).