View Full Version : local and world coordinates
07-30-2003, 01:28 AM
I always come across these two different tems.What do they refer.All these days I assumed there is only one coordinates which is the screen coordinate.Can any one provide difference with some examples
07-30-2003, 04:08 AM
you have a model which is defined in local coordinates. that means that if you want to put the model in your scene, you have to translate+rotate it to the correct location.
using glTranslate and glRotate, you manipulate the modelview matrix. when you call rendering functions, the vertice you give to opengl are transformed by this matrix.
after this transformation, the vertice are in eye coordinate.
in fact the modelview matrix combine two transformation: the view tranformation and the model transformation. first, the vertice are transformed by the model matrix and then are in world coordinate. then those vertice are transformed by the view matrix to get them in view coordinate.
when modelview transfo is done, the vertice are transformed by the projection matrix. then they are in screen coordinate.
07-30-2003, 04:44 AM
BTW, wtf is happening with normal? When I specify it I specify it in object(model/local) coordinates. In vshader I must mul it with MIT to get from Eye(View) to Obj coords, though vertex position is still in object coords and must be transformed by matrices later. So it comes that normal is transformed by Modelview before passing to vp, but vertices arn't
07-30-2003, 06:06 AM
normals are not pre-transformed by modelview before VP.
modelview is a 4x4 matrix. the upper left 3x3 matrix represent the rotation.
| tx |
| R ty |
| tz |
| 0 0 0 1 |
a 3x3 rotation matrix has this property:
R^-1 (inverse) == R^t (transpose)
so, modelview inverse transpose is:
| 0 |
| R 0 |
| 0 |
| tx ty tz 1 |
in a VP, you have to transform the normal only by the rotation matrix (it have no sense to translate a normal). since in a VP you don't have the 3x3 rotation matrix, you have to use the inversed transposed modelview matrix.
07-30-2003, 06:08 AM
a little mistake, the inversed transposed modelview matrix is;
| 0 |
| R 0 |
| 0 |
| -tx -ty -tz 1 |
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.