CSCI 420: Computer Graphics
Hao Li
http://cs420.hao-li.com
Fall 2018
7.1 Rasterization
1
7.1 Rasterization Hao Li http://cs420.hao-li.com 1 Rendering - - PowerPoint PPT Presentation
Fall 2018 CSCI 420: Computer Graphics 7.1 Rasterization Hao Li http://cs420.hao-li.com 1 Rendering Pipeline 2 Outline Scan Conversion for Lines Scan Conversion for Polygons Antialiasing 3 Rasterization (scan conversion)
CSCI 420: Computer Graphics
http://cs420.hao-li.com
Fall 2018
1
2
3
4
5
6
slope restriction needed
7
for (i = x1; i <= x2; i++) { y += m; write_pixel(i, round(y), color); }
cases
8
But still requires floating point additions!
9
10
11
12
2m − 2 = 2(∆y ∆x − 1)
13
void draw_line(int x1, int y1, int x2, int y2) { int x, y = y1; int dx = 2*(x2-x1), dy = 2*(y2-y1); int dydx = dy-dx, D = (dy-dx)/2; for (x = x1 ; x <= x2 ; x++) { write_pixel(x, y, color); if (D > 0) D -= dy; else {y++; D -= dydx;} } }
14
15
16
17
xl xr
an odd number of crossings
18
smallest ymin up
19
polygons into triangles
20
21
22
23
24
continuous to discrete)
digital signal processing): we sample a continues image at grid points
25
Moire pattern from sandlotscience.com
26
27
(e.g., ray tracing)
28
pixel
perturb a regular grid of samples
29
with real hardware (photo and video cameras)
(shutter speed)
30
Motion blur
31
32
Achieve by stochastic sampling in time
16 samples / pixel / timestep
33
http://cs420.hao-li.com
34