(This is a similar question to extracting scale matrix from modelview matrix ) but I think it's a bit more general, so I'm reposting it.
I have a modelview matrix in WebGL, composed of a series of transformations from local object space to world space, followed by a transformation from world space to homogeneous WebGL coordinates (-1 to 1 in all directions).
This matrix is built up throughout our code over a series of convoluted steps. One of these steps is to render to a texture, and then blit the texture onto the screen. This process is extracted to be generalized so we can use it for any 2D texture painting operation. Unfortunately, it provides its own view/projection transformation. At the point at which I'm calling this, I have only the combined modelview matrix.
What I want to do is preserve the transformations made on the modelview matrix as it's built up along the way, but I don't want to include the view transformation. In other words, given a modelview matrix, and a known view transformation, is there a way to extract just the model transformation as a matrix?
We're not using perspective projection, and all of our transformations are 2-dimensional in nature, so a general solution isn't necessary (although I have had this question before when working in 3D, so something that could be extended to 3D would be really useful).