Perspective Projection
field-of-view and aspect ratio
由fovY和距离、高度之间相互换算
Canonical cube to screen
1. What's a screen ?
- An array of pixels
- Size of the array : resolution(分辨率)
- A typical kind of raster display
2. Raster==screen in German
- Rasterize==drawing on the screen
3. Pixel
- A pixel is a square with uniform color
- color is a mixture of red,green and blue
Defining the screen space
indeces are from to
Transform
- Irrelevant to z
- Transform in xy plane
- Viewport transform matrix:
Rasterization:
Triangles-Fundamental Shape Primitives
Why triangles?
- Basic polygen
- Break up other polygens
- Guaranteed to planar
- Well defined for interpolating
Sampling
Evaluating a function at a point is sampling.
We can discretize a function by sampling.
Define Binary Function
for(int x=0; x< x_max;x++)
for(int y=0; y< y_max; y++ )
inside(triangle , x+0.5 , y+0.5 )
Using a Bounding Box
No need to check all pixels
Incremental Triangle Traversal
suitable for thin and rotated triangles