# Viewing Pipeline(OpenGL)
###### tags: `course` `computer graphic`

* Modelview = model matrix(把物件座標投到world space) * View matrix (把世界座標轉到eye space)
* Projection Matrix => normalize view volume
* cliping => 去除超出view volume的部份
* perspective division => homogenous space to cartisen space
* viewport matrix (三維座標 => 視窗座標)
## 名詞解釋
### view coordinate system
1. camera position
2. viewing direction
3. up vector
### view volume for perspective projection
1. view plane distance
2. windows or angle of view
3. near and far clipping plane distance

## proccess
+ View transformation(world space to eye space,projection)
+ View-volume clipping + Back face culling
+ Window-viewport mapping
+ Modelview matrix -> Projection matreix -> perspective division -> viewport Transformaiotn -> window coordinates
## View transformation
Transformation objects from world coordinate system to the view coordinate system
> 方便perspective projection運算
> 幫含旋轉和轉移
## View projection
Transforms the view volume to a normalized view volume and does the orthogonal projection.
> 方便硬體做clipping(因為都是與基底向量平行)
> 所有投影都變成orthogonal projection(去掉一個為度即可)
> 含轉移,shearing(剪力),scaling
> 方便平行投影或perspective projection
>
Converting view frustum(錐台又稱平截頭體) to normalized view volume(正立方體)
> 方便clipping culling
> 讓projection變成orthogonal
> 維持深度方便z buffer test
## Window-to-viewport mapping
Map the window on the view plane to a viewport on the screen
Involves translation and scaling