View Full Version : local and world coordinates
iris_raj
07302003, 12:28 AM
Dear All,
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
With regards
RAJESH.R
RAIC,
errno
07302003, 03:08 AM
an example:
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.
local coordinate

MODEL matrix

world coordinate

VIEW matrix

view coordinate

PROJECTION matrix

screen coordinate
M/\dm/\n
07302003, 03: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
errno
07302003, 05:06 AM
normals are not pretransformed 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.
errno
07302003, 05: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.5 Copyright © 2018 vBulletin Solutions Inc. All rights reserved.