05Rasterization 1 (Triangles
- 一、Rasterization 1 (Triangles)
)
一、Rasterization 1 (Triangles)
vertical field-of-view (fovY) andaspect ratio
长宽比和垂直的可视角度
How to convert from fovY and aspect to l,r, b, t?Trivial
What’s after MVP?
将物体锁定在(-1,1)^3的立方体内
Canonical Cube to Screen
What is a screen?
- An array of pixels
- Size of the array: resolution
- A typical kind of raster display
Raster == screen in German - Rasterize == drawing onto the screen
Pixel (FYl, short for “picture element”) - For now: A pixel is a little square with uniform color
- Color is a mixture of (red, green, blue)
以屏幕的左下角为原点开始确定坐标。
Pixels’ indices are in the form of (x, y)., where both x and y are integers
Pixels" indices are from(0, 0) to (width - 1, height - 1)
Pixel (x, y) is centered at(+0.5,y+0.5)
将宽高由(-1,1)拉长w,h
Drawing Machines
Laser Cutters
Different Raster Displays
Oscilloscope 示波器
Cathode Ray Tube 阴极射线管
隔行扫描,短暂的视觉暂留。高速运动时会产生严重的画面撕裂。
Frame Buffer: Memory for a Raster Display
内存的区域映射到屏幕上
Flat Panel Displays
LCD(iiquid Crystal Display)Pixel 液晶
光经过光栅只会留下在这个方向震动的波
通过光栅液晶的扭曲得到目标角度的光线。
LED Array Display 发光二极管
electropnoretic (Electronic lnk) Display 电子墨 kindle
- Drawing to Raster Displays*
Triangle Meshes表示二位空间
Triangles - Fundamental Shape Primitives:
- Most basic polygon
- Break up other polygons
Unique properties - Guaranteed to be planar
- Well-defined interior
- Well-defined method for interpolating values atvertices over triangle (barycentric interpolation)
A Simple Approach: Sampling采样
Samping a Function
Evaluating a function at a point is sampling.we can discretize a function by sampling.将函数离散化
以中心点采样
for (int x = 0; x < xmax; ++x)
for (int y=0; y <ymax; ++y)
image [x][y] = inside (tri,
+0. 5,y + 0.5) ;
p1p2*p1q朝外,在p1p2左侧
经过三次判断确定在以上那个区域内
若点在三角形边界上如何判定由自己觉定。
轴向包围盒
各种神奇的加速方法
Rasterization on Real Displays
bayer parten 绿色的点更多,因为人眼对绿色更为舒服
==Jaggies!==Aliasing
抗锯齿,防走样