2012年12月27日 星期四

WebGL(2)


第四章 Camera

These matrices represent transformations that when applied to our scene, allow us to move thing around.

matrices代表camera物件

每次移動camera,需要去更新4-4matrix根據camera新的位置

Homogeneous coordinate
h(x,y,z,w)=v(x/w,y/w,z/w)
v(x,y,z)=h(x,y,z,1)















View origin 視點eyecamera相對位於world origin
NDC(Normalize device Coordinate)
In NDC space, the x and y coordinate represent the location of your vertices on a normalized 2D scene, while the z-coordinate encodes depth information.

因為物件縮放,法向量不再垂直90度角
S'=MS
N'=KN
N'.S'=0
(KN).(MS)=0
(KN)^T(MS)=0
N^TK^TMS=0
N^T(K^TM)S=0
因為N^TS=0
所以K^TM=I







1.The Model-View Matrix that groups the model and view transform in one single matrix.
2.The Normal matrix is obtained by inverting and transposing the Model-View Matrix.
3.The perspective matrix groups the projection transformation and the perspective division.

uMVMatrix the model-view matrix
uPMatrix the perspective matrix
uNMatrix the normal Matrix














沒有留言:

張貼留言