Aspect ratio = width/height
由图易得 tan(fovY/2) = t/|n| aspect = n/t
What is MVP?
Model transformation
View transformation
Projection transformation
-- Orthographic projection(cuboid to "canonial" cube[-1,1]3)
-- Perspective projection(frustum to "canonial" cube)
Canonial cube to Screen
[-1,1]2 ---> [0, width] * [0, height]
Rasterizing Triangles into pixels
Triangles-Fundamental Shape Primitives
Q : WHY TRIANGLES?
A :
- most basic polygon
- break up other polygons
- Unique properties
- guranteed to be planar
- Well-defined interior(存在明确的正反面)
- Well-defined method for interpolating values for vertices over tirangle(barycentric interpolation 中心坐标插值)
for(int x = 0 ; x < xmax ; ++x)
for(int y = 0 ; y < ymax ; ++y)
image[x][y] = inside(tir,x+0.5,y+0.5);
Evaluating inside(tir,x,y) How to realize?
Recall : Three cross products
Checking all pixels on the screen?
==> use a bounding box
for(int x = xmin ; x < xmax ; ++x)
for(int y = min ; y < ymax ; ++y)
image[x][y] = inside(tir,x+0.5,y+0.5);
==> Incremental Triangle Traversal(faster?)
suitable for thin and rotated triangles(增量三角遍历,只寻找三角形的最左和最右)
Bayer Partern --> one method to represent pixels
What is wriong with pictures after being rasterizd?
==> Aliasing(jaggies) 锯齿 ->采样率
参考链接:bilibili.com/video/BV1X7411F744?p=5(GAMES101-现代计算机图形学入门-闫令琪)