2D Viewing
Modified By Prof.Viswanathan.P
pviswanathan@vit.ac.in
Contents
3D Rendering Pipeline
2D Rendering Pipeline
Clipping
CGVR
Viewport Transformation
Scan Conversion
Summary of Transformation
pviswanathan@vit.ac.in
3D Rendering Pipeline
CGVR
3D Primitives
3D Modeling Coordinates
Model Transformation
3D World Coordinates
Lighting
3D World Coordinates
Viewing Transformation
3D Viewing Coordinates
Projection Transformation
2D Projection Coordinates
Clipping
2D Projection Coordinates
Viewport Transformation
2D Device Coordinates
Scan Conversion
2D Device Coordinates
Image
pviswanathan@vit.ac.in
3D Rendering Pipeline
CGVR
3D Primitives
3D Modeling Coordinates
Model Transformation
3D World Coordinates
Lighting
3D World Coordinates
Viewing Transformation
3D Viewing Coordinates
Projection Transformation
2D Projection Coordinates
Clipping
2D Projection Coordinates
Viewport Transformation
2D Device Coordinates
Scan Conversion
2D Device Coordinates
Image
pviswanathan@vit.ac.in
2D Rendering Pipeline
CGVR
3D Primitives
2D Primitives
Clipping
Viewport Transformation
Scan Conversion
Image
pviswanathan@vit.ac.in
2D Rendering Pipeline
CGVR
3D Primitives
2D Primitives
Clipping
Viewport Transformation
Scan Conversion
Image
pviswanathan@vit.ac.in
Clipping
CGVR
World
Coordinates
pviswanathan@vit.ac.in
Clipping
CGVR
pviswanathan@vit.ac.in
Clipping
CGVR
Points
Lines
Polygons
Circles
etc.
pviswanathan@vit.ac.in
Point Clipping
CGVR
wy2
Inside =
(x>=wx1) &&
(x<=wx2) &&
(x, y)
(y>=wy1) &&
(y<=wy2);
wy1
wx1
pviswanathan@vit.ac.in
wx2
10
Line Clipping
CGVR
P4
P8
P3
P2
P6
P5
pviswanathan@vit.ac.in
11
P10
P9
Before Clipping
Graphics Lab @ Korea University
Line Clipping
CGVR
P4
P8
P3
P6
P5
After Clipping
pviswanathan@vit.ac.in
12
Cohen-Sutherland Line
Clipping
CGVR
P4
P8
P3
P2
P6
P5
pviswanathan@vit.ac.in
13
P10
P9
Graphics Lab @ Korea University
Cohen-Sutherland Line
Clipping
CGVR
P3
P2
0000
P6
0101
P5
Bit 1
pviswanathan@vit.ac.in
P8
0010
14
0100
P10
P9
Bit 3
0110
Bit 2
Graphics Lab @ Korea University
Cohen-Sutherland Line
Clipping
CGVR
P3
P2
0000
P6
0101
P5
Bit 1
pviswanathan@vit.ac.in
P8
0010
15
0100
P10
P9
Bit 3
0110
Bit 2
Graphics Lab @ Korea University
Cohen-Sutherland Line
Clipping
CGVR
P3
P8
0010
0000
P6
0101
P5
Bit 1
pviswanathan@vit.ac.in
16
0100
P10
P9
Bit 3
0110
Bit 2
Graphics Lab @ Korea University
Cohen-Sutherland Line
Clipping
CGVR
P4
0001
P3
P8
0010
0000
P6
0101
P5
Bit 1
pviswanathan@vit.ac.in
17
0100
P10
P9
Bit 4
Bit 3
0110
Bit 2
Graphics Lab @ Korea University
Cohen-Sutherland Line
Clipping
CGVR
P4
0001
P3
P8
0010
0000
P6
0101
P5
Bit 1
pviswanathan@vit.ac.in
18
0100
P10
P9
Bit 4
Bit 3
0110
Bit 2
Graphics Lab @ Korea University
Cohen-Sutherland Line
Clipping
CGVR
P4
0001
P3
P8
0010
0000
P6
P5
0101
Bit 1
pviswanathan@vit.ac.in
19
0100
P10
P9
Bit 4
Bit 3
0110
Bit 2
Graphics Lab @ Korea University
Cohen-Sutherland Line
Clipping
CGVR
P4
0001
P3
P8
0010
0000
P6
P5
0101
Bit 1
pviswanathan@vit.ac.in
20
0100
P10
P9
Bit 4
Bit 3
0110
Bit 2
Graphics Lab @ Korea University
Cohen-Sutherland Line
Clipping
CGVR
P4
0001
P3
P8
0010
0000
P6
P5
0101
Bit 1
pviswanathan@vit.ac.in
21
0100
P10
P9
Bit 4
Bit 3
0110
Bit 2
Graphics Lab @ Korea University
Cohen-Sutherland Line
Clipping
CGVR
P4
0001
P3
P8
0010
0000
P6
P5
0101
Bit 1
pviswanathan@vit.ac.in
22
0100
P10
P9
Bit 4
Bit 3
0110
Bit 2
Graphics Lab @ Korea University
Cohen-Sutherland Line
Clipping
CGVR
P4
0001
P3
P8
0010
0000
P6
P5
0101
Bit 1
pviswanathan@vit.ac.in
23
0100
P10
P9
Bit 4
Bit 3
0110
Bit 2
Graphics Lab @ Korea University
Cohen-Sutherland Line
Clipping
CGVR
P4
0001
P3
P8
0010
0000
P6
P5
0101
Bit 1
pviswanathan@vit.ac.in
24
0100
P10
P9
Bit 4
Bit 3
0110
Bit 2
Graphics Lab @ Korea University
Cohen-Sutherland Line
Clipping
CGVR
P4
0001
P3
0000
P8
0010
P6
P5
0101
Bit 1
pviswanathan@vit.ac.in
25
0100
P10
P9
Bit 4
Bit 3
0110
Bit 2
Graphics Lab @ Korea University
Cohen-Sutherland Line
Clipping
CGVR
P4
0001
P3
0000
P8
0010
P6
P5
0101
Bit 1
pviswanathan@vit.ac.in
26
0100
P10
P9
Bit 4
Bit 3
0110
Bit 2
Graphics Lab @ Korea University
Cohen-Sutherland Line
Clipping
CGVR
P4
0001
P3
0000
P8
0010
P6
P5
0101
Bit 1
pviswanathan@vit.ac.in
27
0100
P10
P9
Bit 4
Bit 3
0110
Bit 2
Graphics Lab @ Korea University
Cohen-Sutherland Line
Clipping
CGVR
P4
0001
P3
0000
P8
0010
P6
P5
0101
Bit 1
pviswanathan@vit.ac.in
28
0100
P10
P9
Bit 4
Bit 3
0110
Bit 2
Graphics Lab @ Korea University
Cohen-Sutherland Line
Clipping
CGVR
P4
0001
P3
0000
P8
0010
P6
P5
0101
Bit 1
pviswanathan@vit.ac.in
29
0100
Bit 4
P10
P90110
Bit 3
Bit 2
Graphics Lab @ Korea University
Cohen-Sutherland Line
Clipping
CGVR
P4
0001
P3
0000
P8
0010
P6
P5
0101
Bit 1
pviswanathan@vit.ac.in
30
0100
Bit 4
P10
P90110
Bit 3
Bit 2
Graphics Lab @ Korea University
Cohen-Sutherland Line
Clipping
CGVR
P4
0001
P3
0000
Bit 4
P8
0010
P6
P5
0101
Bit 1
pviswanathan@vit.ac.in
31
Bit 3
0100
0110
Bit 2
Graphics Lab @ Korea University
Polygon Clipping
CGVR
Before Clipping
pviswanathan@vit.ac.in
32
Polygon Clipping
CGVR
After Clipping
pviswanathan@vit.ac.in
33
Sutherland-Hodgeman Polygon
Clipping
CGVR
pviswanathan@vit.ac.in
34
Sutherland-Hodgeman Polygon
Clipping
CGVR
pviswanathan@vit.ac.in
35
Sutherland-Hodgeman Polygon
Clipping
CGVR
pviswanathan@vit.ac.in
36
Sutherland-Hodgeman Polygon
Clipping
CGVR
pviswanathan@vit.ac.in
37
Sutherland-Hodgeman Polygon
Clipping
CGVR
pviswanathan@vit.ac.in
38
Clipping to a Boundary
CGVR
P1
Window
Boundary
Inside
P5
P3
Outside
P4
pviswanathan@vit.ac.in
39
Clipping to a Boundary
CGVR
P1
Window
Boundary
Inside
P5
P3
Outside
P4
pviswanathan@vit.ac.in
40
Clipping to a Boundary
CGVR
P1
Window
Boundary
Inside
P5
P3
Outside
P4
pviswanathan@vit.ac.in
41
Clipping to a Boundary
CGVR
P1
Window
Boundary
Inside
P5
P3
Outside
P4
pviswanathan@vit.ac.in
42
Clipping to a Boundary
CGVR
P1
Window
Boundary P
Inside
P5
P3
Outside
P4
pviswanathan@vit.ac.in
43
Clipping to a Boundary
CGVR
P1
Window
Boundary P
Inside
P5
P3
Outside
P4
pviswanathan@vit.ac.in
44
Clipping to a Boundary
CGVR
P1
Window
Boundary P
Inside
P5
P3
Outside
P4
pviswanathan@vit.ac.in
45
Clipping to a Boundary
CGVR
P1
Window
Boundary P
P
P5
P3
Inside
Outside
P4
pviswanathan@vit.ac.in
46
Clipping to a Boundary
CGVR
P1
Inside
Outside
pviswanathan@vit.ac.in
47
2D Rendering Pipeline
CGVR
3D Primitives
2D Primitives
Clipping
Viewport Transformation
Scan Conversion
Image
pviswanathan@vit.ac.in
48
Viewport Transformation
CGVR
Image
Viewport
pviswanathan@vit.ac.in
49
Window
CGVR
Viewport
pviswanathan@vit.ac.in
50
Viewport Transformation
CGVR
Window-to-Viewport Mapping
Window
wy2
Viewport
vy2
(wx, wy)
wy1
wx1
(vx, vy)
wx2
Screen Coordinates
vy1
vx1
vx2
Image Coordinates
51
2D Rendering Pipeline
CGVR
3D Primitives
2D Primitives
Clipping
Viewport Transformation
Scan Conversion
Image
pviswanathan@vit.ac.in
52
Scan Conversion
Definition
CGVR
Example
P1
P2
pviswanathan@vit.ac.in
53
P3
Graphics Lab @ Korea University
CGVR
Simple Algorithm
L1
L3
L2
pviswanathan@vit.ac.in
54
CGVR
dx
dy
pviswanathan@vit.ac.in
55
CGVR
Triangle
Quadrilateral
Convex
Star-Shaped
Concave
Self-Intersecting
Holes
pviswanathan@vit.ac.in
56
CGVR
L2
L5
L2
L5B
L5A
L3
L3
L4
Convex Polygon
pviswanathan@vit.ac.in
57
L4
Concave Polygon
Graphics Lab @ Korea University
CGVR
Odd-Parity Rule
Concave
pviswanathan@vit.ac.in
Self-Intersecting
58
With Holes
Graphics Lab @ Korea University
CGVR
Triangle
pviswanathan@vit.ac.in
59
Polygon
Graphics Lab @ Korea University
CGVR
pviswanathan@vit.ac.in
60
Summary of Transformation
CGVR
P(x, y, z)
3D Object Coordinates
Modeling
Transformation
3D World Coordinates
Viewing
Transformation
3D Viewing Coordinates
Projection
Transformation
2D Projection Coordinates
Window-to-Viewport
Transformation
2D Device Coordinates
P(x, y)
pviswanathan@vit.ac.in
61