Presentation is loading. Please wait.

Presentation is loading. Please wait.

Rasterizing Polygons 2 Lecture 35 Mon, Nov 26, 2007.

Similar presentations


Presentation on theme: "Rasterizing Polygons 2 Lecture 35 Mon, Nov 26, 2007."— Presentation transcript:

1 Rasterizing Polygons 2 Lecture 35 Mon, Nov 26, 2007

2 A Rasterization Algorithm
The following algorithm is designed to allow rapid shading of the pixels. As the vertices are given, create a list of the vertices. (The order matters!) {(1, 0), (4, 3), (6, 1), (12, 1), (11, 8), (7, 8), (6, 5), (4, 8), (0, 7), (1, 0)}. From the list of vertices, form an edge table. {{(1, 0), (4, 3)}, {(4, 3), (6, 1)}, …, {(0, 7), (1, 0)}}.

3 A Rasterization Algorithm
Organization of the edge table. Eliminate any horizontal edges. Sort the edges in the edge table by the y-coordinate of the lower endpoint. Begin scanning with the bottom scan line.

4 The Active Edge Table Create the active edge table (AET).
For each edge in the edge table whose lower endpoint is on the scan line, Create an active-edge-table entry. Add it to the active edge table. Delete the edge from the edge table.

5 The Active Edge Table Organization of an active-edge-table entry:
y-coordinate of upper endpoint. Reciprocal of the slope. x-intercept with the horizontal line ½ unit above the current scan line.

6 The Active Edge Table Active edges Scan line

7 The Active Edge Table (7, -1/7, 13/14) Scan line (3, 1, 1-1/2)

8 The Active Edge Table Sort the AET entries by their x-intercepts.
The AET must contain an even number of entries. Why? Shade pixels from the 1st to the 2nd x-intercepts, 3rd to 4th x-intercepts, etc., in the AET.

9 The Active Edge Table (7, -1/7, 13/14) (no shading on Scan
this scan line) Scan line (3, 1, 1-1/2)

10 The Active Edge Table Update the AET. Increment the scan line number.
Delete from the AET any entries for which the upper endpoint is on the scan line. Update the x-intercepts of all AET entries. Add the reciprocal slope to the x-intercept. Create and add entries from the edge table for edges whose lower endpoint is on the scan line.

11 A Rasterization Algorithm
(7, -1/7, 13/14) Scan line (3, 1, 1-1/2)

12 A Rasterization Algorithm
(7, -1/7, 11/14) Scan line (8, -1/7, 11-13/14) (3, 1, 2-1/2) (3, -1, 5-1/2)

13 A Rasterization Algorithm
(7, -1/7, 11/14) Scan line (8, -1/7, 11-13/14) (3, 1, 2-1/2) (3, -1, 5-1/2)

14 A Rasterization Algorithm
(7, -1/7, 9/14) Scan line (8, -1/7, 11-11/14) (3, 1, 3-1/2) (3, -1, 4-1/2)

15 A Rasterization Algorithm
(7, -1/7, 9/14) Scan line (8, -1/7, 11-11/14) (3, 1, 3-1/2) (3, -1, 4-1/2)

16 A Rasterization Algorithm
(7, -1/7, 1/2) Scan line (8, -1/7, 11-9/14)

17 A Rasterization Algorithm
(7, -1/7, 1/2) Scan line (8, -1/7, 11-9/14)

18 A Rasterization Algorithm
(7, -1/7, 5/14) Scan line (8, -1/7, 11-1/2)

19 A Rasterization Algorithm
(7, -1/7, 5/14) Scan line (8, -1/7, 11-1/2)

20 A Rasterization Algorithm
(8, -2/3, 5-5/6) (8, 1/3, 6-1/6) (7, -1/7, 3/14) Scan line (8, -1/7, 11-5/14)

21 A Rasterization Algorithm
(8, -2/3, 5-2/3) (8, 1/3, 6-1/6) (7, -1/7, 3/14) Scan line (8, -1/7, 11-5/14)

22 A Rasterization Algorithm
(8, -2/3, 5) (8, 1/3, 6-1/2) (7, -1/7, 1/14) Scan line (8, -1/7, 11-3/14)

23 A Rasterization Algorithm
(8, -2/3, 5) (8, 1/3, 6-1/2) (7, -1/7, 1/14) Scan line (8, -1/7, 11-3/14)

24 A Rasterization Algorithm
(8, -2/3, 5) (8, 1/3, 6-1/2) (8, 4, 2) Scan line (8, -1/7, 11-3/14)

25 A Rasterization Algorithm
(8, -2/3, 5) (8, 1/3, 6-1/2) (8, 4, 2) Scan line (8, -1/7, 11-3/14)

26 A Rasterization Algorithm

27 Rasterizing Polygons Read Run

28 Rasterizing Polygons in OpenGL
Read Run

29 Freehand Polygons Read Run


Download ppt "Rasterizing Polygons 2 Lecture 35 Mon, Nov 26, 2007."

Similar presentations


Ads by Google