Introduction and Graphics
Pipeline
Advanced Multimedia Technology: Computer Graphics
Yung-Yu Chuang
2005/12/07
with slides by Brian Curless, Zoran Popovic, Robin Chen and Doug J ames
Introduction
• Instructor: Yung-Yu Chuang ( 莊永裕 ) • E-mail: cyy@csie.ntu.edu.tw
• Office: CSIE 527 • Web:
What is Computer Graphics ?
• Definition
– the pictorial synthesis of real or imaginary objects from their computer-based models
descriptions images
descriptions Computer Graphics images Computer Vision Image Processing
OUTPUT
IN
P
U
Computer graphics
Computer graphics
modeling rendering
Applications • Movies • Interactive entertainment • Industrial design • Architecture • Culture heritage
Animation production pipeline
story text treatment storyboard
Animation production pipeline
layout animation
shading/lighting
modeling/articulation
Scan converting lines
• A scan-converted line showing intensified pixels as black circles
The basic incremental algorithm x m y B x x m B mx yi1 i1 ( i ) i (xi,Round(yi)) (xi,yi) (xi+1,yi+m) (xi+1,Round(yi+m)) Desired line
The basic incremental algorithm
void Line (int x0, int y0, int x1, int y1, value) { int x; float dy, dx, y, m; dy=y1-y0; dx=x1-x0; m=dy/dx; y=y0; for (x=x0; x<=x1; x++) {
WritePixel (x, (int)floor(y+0.5), value); y+=m;
} }
Filling Polygons 2 4 6 8 10 12 14 2 4 6 8 10 12 A B C D E F a b c d Scan line
Filling Polygons
Filling Polygons
1. find the intersections of the scan line with all edges of the polygon
2. sort the intersections by increasing x coordinate
3. fill in all pixels between pairs of intersections that lie interior to the polygon
Limitations of a 2X2 matrix • Scaling • Rotation • Reflection • Shearing • What do we miss?
Parallel and perspective projections
Visibility Algorithms
• Painter’s algorithm • Ray casting
• Z-buffer