Working on shadow rendering via shadow volumes. But part of the code needs to find the position of a light in object cordinents. Here is a list of the data I have.
The Transforation Matrix for the Object
The location of the light in World Cor.
I need the location of the light relative to the model. What I have been doing is extracting the 3, 7, and 11th elements from the matrix (which are the transformation section) and subtracting them from the light’s position. However, this method fails to take into account the scale, shear, rotation elemets.
Right, I kindof knew that, but could someone supply an OpenGL example? How do I get the inverse of a matrix without knowing the starting values inverse when I build the matrix. Or will this work?