0

Assume I have a modelview projection matrix, mvp and I know that mvp[3][3] !=1 and mvp[3][3] > 0

Can I assume that the model matrix performed the scaling or since the projection matrix itself performs scaling this number is not useful without the original matrices?

Makogan
  • 8,208
  • 7
  • 44
  • 112
  • I haven't thought it through, but I suspect the answer is no. By scaling I assume you mean that the transformation doesn't preserve volume, which is another way to say the determinant is not 1. Maybe that's something to look at -- is the determinant = 1? Bear in mind that volume-preserving might include shearing. If you want to rule out shearing (so, I guess, the transformation is only a rotation) I guess you would need to look at all 3 eigenvalues or something equivalent to that. You might take up this question on math.stackexchange.com. – Robert Dodier Oct 12 '18 at 19:55
  • the `mvp[3][3]` element is homogenuous numerical value just allowing booth rotation and translation in single matrix. To get/inspect scale see [extracting scale matrix from modelview matrix](https://stackoverflow.com/a/33539644/2521214) – Spektre Oct 14 '18 at 08:58

1 Answers1

1

No, this value alone does not tell you much. Consider a diagonal matrix like the following:

d  0  0  0
0  d  0  0
0  0  d  0
0  0  0  d

d is an arbitrary number.

This matrix is essentially the homogeneous equivalent of the identity matrix and does not perform any transformation at all. The uniform scaling part in the upper left 3x3 block is cancelled out by the perspective divide. You can always multiply the matrix by the inverse of the m33 entry to somewhat normalize it (this will preserve the transformation). For the above matrix, you would then get:

1  0  0  0
0  1  0  0
0  0  1  0
0  0  0  1

And in this form, you can easily see that it is the identity. Moreover, you can examine the upper left 3x3 block to find out if there is a scaling (depending on your definition of scaling, calculating the determinant of the 3x3 block and checking for 1 is one option as Robert mentioned in the comments).

Nico Schertler
  • 32,049
  • 4
  • 39
  • 70