Understanding the ModelView Matrix

天涯浪子 提交于 2020-01-07 03:45:07

问题


I want to analyze the each component of my 4*4 ModelView Matrix.

I came to know that the starting 3*3 of ModelView Matrix stores rotation.

If i want my object to have no rotation with respect to camera so My ModelView Matrix looks like this

How to change my ModelView Matrix if i want to have NO Translation or Scaling ? Can anyone explain the Maths behind this.


回答1:


The upper left 3×3 defines the base vectors of a coordinate system. It's not just rotation but also scaling, shearing and similar stuff. Imagine three rubber legs which you can stretch and angle into any direction. This is what the upper left 3×3 does. If you want to rotate a coordinate system, you rotate the tree legs labeled X, Y, Z each into the direction you want to denote by that moniker in the other coordinate system. If you want to scale things, you stretch each leg. If you make them nonperpendicular things get sheared. That's really all there is to it.

However because everything (except translation) is intermingled in that upper left 3×3 part it's not trivial to "extract" the individual transformations from it. The rough steps to follow are:

  1. Major axis transform by the Principal axis theorem to find the major axis of any anisotropic scaling that may have been applied.
  2. decomposition into shearing and rotation parts.

Translation happens to sit in the rightmost column. The lowermost row must be [0 0 0 1] so that the stuff happening in the rows above it work in the desired way.




回答2:


The question is a bit more difficult than you realise. Whilst it is true that we can identify elements of the matrix as contributing to x axis scale, y axis scale, rotation, translation and so on, as transforms are iteratively applied, these get mixed up. To get the components back, you have to do a QRT decomposition of the matrix, which will be a bit beyond your level (not much, but it's not something you can expect to understand whilst your basic understanding of matrices is still a bit shaky).



来源:https://stackoverflow.com/questions/39816422/understanding-the-modelview-matrix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!