CS 445 / 645 Introduction to Computer Graphics Lecture 8 Triangle Rasterization Lecture 8 Triangle Rasterization.

Slides:



Advertisements
Similar presentations
Polygon Scan Conversion – 11b
Advertisements

Computer Graphics Inf4/MSc 1 Computer Graphics Lecture 7 Scanline algorithm and polygon clipping Taku Komura.
CS 4731: Computer Graphics Lecture 20: Raster Graphics Part 1 Emmanuel Agu.
Section 3-1 to 3-2, 3-5 Drawing Lines Some of the material in these slides may have been adapted from university of Virginia, MIT, and Åbo Akademi University.
Computer Graphics 4: Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling By:Kanwarjeet Singh.
CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE.
CS 450: COMPUTER GRAPHICS FILLING POLYGONS SPRING 2015 DR. MICHAEL J. REALE.
Polygon Rasterization
CP411 polygon Lecture 6 1. Scan conversion algorithm for circle 2. Draw polygons 3. Antialiasing.
Computer Graphics Viewing.
Classes of Polygons Planar polygons Non-planar polygons Simple
Different types of Polygons Simple Convex Simple Concave Non-simple : self-intersecting With holes ConvexConcaveSelf-intersecting.
Implementation Dr. Amy Zhang. Reading 2  Hill, Chapters  Hill, Chapter 10.
Graphics Programming: Polygon Filling
Scan Conversion II Revision 1.4 2/13/07 Copyright 2006, Dr. Zachary Wartell, UNCC, All Rights Reserved.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Scan Conversion Week 6, Mon 6 Oct 2003 recap: Bresenham line algorithm scan.
Rasterization Foley, Ch: 3. Pixels are represented as disjoint circles centered on uniform grid Each (x,y) of the grid has a pixel Y X (1,1) (1,2) (0,0)
Graphics Pipeline Rasterization CMSC 435/634. Drawing Terms Primitive – Basic shape, drawn directly – Compare to building from simpler shapes Rasterization.
TOPIC 4 PART III FILL AREA PRIMITIVES POLYGON FILL AREAS CGMB214: Introduction to Computer Graphics.
CGMB 314 Intro to Computer Graphics Fill Area Primitives.
Polygon Scan Conversion and Z-Buffering
Basics of Rendering Pipeline Based Rendering –Objects in the scene are rendered in a sequence of steps that form the Rendering Pipeline. Ray-Tracing –A.
CS 551 / 645: Introductory Computer Graphics
Graphics Pipeline Rasterization CMSC 435/634. Drawing Terms Primitive – Basic shape, drawn directly – Compare to building from simpler shapes Rasterization.
3/4/04© University of Wisconsin, CS559 Spring 2004 Last Time Clipping Lines –Cohen-Sutherland: The use of outcodes and early reject/accept tests –Liang-Barsky:
Informationsteknologi Monday, November 26, 2007Computer Graphics - Class 121 Today’s class Drawing lines Bresenham’s algorithm Compositing Polygon filling.
Rasterization Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006 (Slide set originally by David Luebke)
Triangle Scan Conversion. 2 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Rasterization Rasterization (scan conversion) –Determine which.
Graphics Pipeline Rasterization CMSC 435/634. Drawing Terms Primitive – Basic shape, drawn directly – Compare to building from simpler shapes Rasterization.
College of Computer and Information Science, Northeastern UniversityOctober 12, CS G140 Graduate Computer Graphics Prof. Harriet Fell Spring 2006.
10/15/02 (c) 2002 University of Wisconsin, CS559 Last Time Clipping.
College of Computer and Information Science, Northeastern UniversityMay 27, CS 4300 Computer Graphics Prof. Harriet Fell Fall 2012 Lecture 9 – September.
1 CS 430/536 Computer Graphics I Polygon Clipping and Filling Week 3, Lecture 5 David Breen, William Regli and Maxim Peysakhov Geometric and Intelligent.
2D Output Primitives Points Lines Circles Ellipses Other curves Filling areas Text Patterns Polymarkers.
College of Computer and Information Science, Northeastern UniversityOctober 31, CS G140 Graduate Computer Graphics Prof. Harriet Fell Spring 2009.
CAP4730: Computational Structures in Computer Graphics
Drawing Triangles CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
1 Polygonal Techniques 이영건. 2 Introduction This chapter –Discuss a variety of problems that are encountered within polygonal data sets The.
Computer Graphics Rendering 2D Geometry CO2409 Computer Graphics Week 2.
Introduction to Computer Graphics CS 445 / 645 Lecture 9 Chapter 4: Rasterization L. McMillan MIT notes (Fall ’98)
10/15/02 (c) 2002 University of Wisconsin, CS559 Who Am I? Prof Stephen Chenney These notes will be online after the lecture – in fact they’re online already.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner Rasterization.
1 Computer Graphics Clipping Fall FCC Line Clipping What happens when one or both endpoints of a line segment are not inside the specified drawing.
Computer Graphics Filling. Filling Polygons So we can figure out how to draw lines and circles How do we go about drawing polygons? We use an incremental.
Graphics Pipeline Rasterization CMSC 435/634. Drawing Terms Primitive – Basic shape, drawn directly – Compare to building from simpler shapes Rasterization.
Lecture 15: Raster Graphics and Scan Conversion
Graphics Graphics & Graphical Programming Lecture 23 - Viewing & Clipping.
1 CSCE 441: Computer Graphics Scan Conversion of Polygons Jinxiang Chai.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Rasterization II Week.
Rasterization Overview Raster Display Device. Scan Conversion / Rasterization: converting vector graphics into raster graphics (determining pixels in.
Computer Graphics CC416 Week 14 Filling Algorithms.
Computer Graphics Lecture 08 Taqdees A. Siddiqi Computer Graphics Filled Area Primitives I Lecture 08 Taqdees A. Siddiqi
Rasterization, or “What is glBegin(GL_LINES) really doing?” Course web page: February 23, 2012  Lecture 4.
CS552: Computer Graphics Lecture 16: Polygon Filling.
Computer Graphics Filling.
Introduction to Polygons
Computer Graphics CC416 Week 13 Clipping.
CS G140 Graduate Computer Graphics
(c) 2002 University of Wisconsin, CS559
Fill Area Algorithms Jan
Graphics Pipeline Clipping
© University of Wisconsin, CS559 Fall 2004
Agenda Polygon Terminology Types of polygons Inside Test
CSCE 441 Computer Graphics: Clipping Lines Jinxiang Chai
Prepared by Narendra V G CSE MIT
Agenda Polygon Terminology Types of polygons Inside Test
Prof. Harriet Fell Fall 2011 Lecture 9 – September 26, 2011
(c) 2002 University of Wisconsin, CS559
Rasterization Week 6, Mon Feb 12
Chapter 3 Graphics Output Primitives
Presentation transcript:

CS 445 / 645 Introduction to Computer Graphics Lecture 8 Triangle Rasterization Lecture 8 Triangle Rasterization

Optimization Techniques SymmetrySymmetry

Optimization Techniques Incremental Computation Compute DifferenceCompute Difference Line exampleLine example Incremental Computation Compute DifferenceCompute Difference Line exampleLine example

Incremental Evaluation Noninteger additionNoninteger addition “round” needed“round” needed Noninteger additionNoninteger addition “round” needed“round” needed

Line – Midpoint Evaluation Credited to Bresenham Operate only on integers and avoid roundingOperate only on integers and avoid rounding Create discriminator, d = d 1 – d 2Create discriminator, d = d 1 – d 2 –If d > 0 y increases –If d <= 0 y stays the same Fast incremental evaluation of discriminator is possible with midpoint evaluationFast incremental evaluation of discriminator is possible with midpoint evaluation Credited to Bresenham Operate only on integers and avoid roundingOperate only on integers and avoid rounding Create discriminator, d = d 1 – d 2Create discriminator, d = d 1 – d 2 –If d > 0 y increases –If d <= 0 y stays the same Fast incremental evaluation of discriminator is possible with midpoint evaluationFast incremental evaluation of discriminator is possible with midpoint evaluation y ykyk y k+1 x k+1 } } d2d2 d1d1

Incremental Evaluation Circles – Midpoint discriminator Two dimensional discriminatorTwo dimensional discriminator Simple outputSimple output Circles – Midpoint discriminator Two dimensional discriminatorTwo dimensional discriminator Simple outputSimple output

Incremental Evaluation Circles Simple comparisonsSimple comparisons We just want to know if incremental change in x requires an incremental change in y to stay in circleWe just want to know if incremental change in x requires an incremental change in y to stay in circle –We evaluate descriminator at f(x+1, y) –Do it incrementally Circles Simple comparisonsSimple comparisons We just want to know if incremental change in x requires an incremental change in y to stay in circleWe just want to know if incremental change in x requires an incremental change in y to stay in circle –We evaluate descriminator at f(x+1, y) –Do it incrementally

Incremental Evaluation Circle Discriminator IfIf –you must decrement y Circle Discriminator IfIf –you must decrement y

Incremental Evaluation Circle Note following correction from slides Added inequalitiesAdded inequalities Just like previous example with extra ½ thrown in for roundingJust like previous example with extra ½ thrown in for roundingCircle Note following correction from slides Added inequalitiesAdded inequalities Just like previous example with extra ½ thrown in for roundingJust like previous example with extra ½ thrown in for rounding

Assignment 1 Due one week from today at 5:00 p.m. Use your directory on Blue.unix for turnin Due one week from today at 5:00 p.m. Use your directory on Blue.unix for turnin

Rasterizing Polygons In interactive graphics, polygons rule the world Two main reasons: Lowest common denominator for surfacesLowest common denominator for surfaces –Can represent any surface with arbitrary accuracy –Splines, mathematical functions, volumetric isosurfaces… Mathematical simplicity lends itself to simple, regular rendering algorithmsMathematical simplicity lends itself to simple, regular rendering algorithms –Like those we’re about to discuss… –Such algorithms embed well in hardware In interactive graphics, polygons rule the world Two main reasons: Lowest common denominator for surfacesLowest common denominator for surfaces –Can represent any surface with arbitrary accuracy –Splines, mathematical functions, volumetric isosurfaces… Mathematical simplicity lends itself to simple, regular rendering algorithmsMathematical simplicity lends itself to simple, regular rendering algorithms –Like those we’re about to discuss… –Such algorithms embed well in hardware

Rasterizing Polygons Triangle is the minimal unit of a polygon All polygons can be broken up into trianglesAll polygons can be broken up into triangles Triangles are guaranteed to be:Triangles are guaranteed to be: –Planar –Convex Triangle is the minimal unit of a polygon All polygons can be broken up into trianglesAll polygons can be broken up into triangles Triangles are guaranteed to be:Triangles are guaranteed to be: –Planar –Convex

Triangularization Convex polygons easily triangulated Concave polygons present a challenge Convex polygons easily triangulated Concave polygons present a challenge

Rasterizing Triangles Interactive graphics hardware commonly uses edge walking or edge equation techniques for rasterizing triangles

Edge Walking Basic idea: Draw edges verticallyDraw edges vertically –Interpolate colors down edges Fill in horizontal spans for each scanlineFill in horizontal spans for each scanline –At each scanline, interpolate edge colors across span Basic idea: Draw edges verticallyDraw edges vertically –Interpolate colors down edges Fill in horizontal spans for each scanlineFill in horizontal spans for each scanline –At each scanline, interpolate edge colors across span

Edge Walking: Notes Order three triangle vertices in x and y Find middle point in y dimension and compute if it is to the left or right of polygon. Also could be flat top or flat bottom triangleFind middle point in y dimension and compute if it is to the left or right of polygon. Also could be flat top or flat bottom triangle We know where left and right edges are. Proceed from top scanline downwardsProceed from top scanline downwards Fill each spanFill each span Until breakpoint or bottom vertex is reachedUntil breakpoint or bottom vertex is reached Advantage: can be made very fast Disadvantages: Lots of finicky special casesLots of finicky special cases Order three triangle vertices in x and y Find middle point in y dimension and compute if it is to the left or right of polygon. Also could be flat top or flat bottom triangleFind middle point in y dimension and compute if it is to the left or right of polygon. Also could be flat top or flat bottom triangle We know where left and right edges are. Proceed from top scanline downwardsProceed from top scanline downwards Fill each spanFill each span Until breakpoint or bottom vertex is reachedUntil breakpoint or bottom vertex is reached Advantage: can be made very fast Disadvantages: Lots of finicky special casesLots of finicky special cases

Edge Walking: Disadvantages Fractional offsets: Be careful when interpolating color values! Beware of gaps between adjacent edges Beware of duplicating shared edges Fractional offsets: Be careful when interpolating color values! Beware of gaps between adjacent edges Beware of duplicating shared edges

Edge Equations An edge equation is simply the equation of the line defining that edge Q: What is the implicit equation of a line?Q: What is the implicit equation of a line? A: Ax + By + C = 0A: Ax + By + C = 0 Q: Given a point ( x,y ), what does plugging x & y into this equation tell us?Q: Given a point ( x,y ), what does plugging x & y into this equation tell us? A: Whether the point is:A: Whether the point is: –On the line: Ax + By + C = 0 –“Above” the line: Ax + By + C > 0 –“Below” the line: Ax + By + C < 0 An edge equation is simply the equation of the line defining that edge Q: What is the implicit equation of a line?Q: What is the implicit equation of a line? A: Ax + By + C = 0A: Ax + By + C = 0 Q: Given a point ( x,y ), what does plugging x & y into this equation tell us?Q: Given a point ( x,y ), what does plugging x & y into this equation tell us? A: Whether the point is:A: Whether the point is: –On the line: Ax + By + C = 0 –“Above” the line: Ax + By + C > 0 –“Below” the line: Ax + By + C < 0

Edge Equations Edge equations thus define two half-spaces:

Edge Equations And a triangle can be defined as the intersection of three positive half-spaces: A 1 x + B 1 y + C 1 < 0 A 2 x + B 2 y + C 2 < 0 A 3 x + B 3 y + C 3 < 0 A 1 x + B 1 y + C 1 > 0 A 3 x + B 3 y + C 3 > 0 A 2 x + B 2 y + C 2 > 0

Edge Equations So…simply turn on those pixels for which all edge equations evaluate to > 0:

Using Edge Equations Which pixels: compute min,max bounding box Edge equations: compute from vertices Orientation: ensure area is positive (why?) Which pixels: compute min,max bounding box Edge equations: compute from vertices Orientation: ensure area is positive (why?)

Computing Edge Equations Want to calculate A, B, C for each edge from ( x 1, y 1 ) and ( x 2, y 2 ) Treat it as a linear system: Ax 1 + By 1 + C = 0 Ax 2 + By 2 + C = 0 Notice: two equations, three unknowns What can we solve? Goal: solve for A & B in terms of C Want to calculate A, B, C for each edge from ( x 1, y 1 ) and ( x 2, y 2 ) Treat it as a linear system: Ax 1 + By 1 + C = 0 Ax 2 + By 2 + C = 0 Notice: two equations, three unknowns What can we solve? Goal: solve for A & B in terms of C

Computing Edge Equations Set up the linear system: Multiply both sides by matrix inverse: Let C = x 0 y 1 - x 1 y 0 for convenience Then A = y 0 - y 1 and B = x 0 – x 1Then A = y 0 - y 1 and B = x 0 – x 1 Set up the linear system: Multiply both sides by matrix inverse: Let C = x 0 y 1 - x 1 y 0 for convenience Then A = y 0 - y 1 and B = x 0 – x 1Then A = y 0 - y 1 and B = x 0 – x 1

Edge Equations So…we can find edge equation from two verts. Given three corners P 0, P 1, P 2 of a triangle, what are our three edges? How do we make sure the half-spaces defined by the edge equations all share the same sign on the interior of the triangle? A: Be consistent (Ex: [P 0 P 1 ], [P 1 P 2 ], [P 2 P 0 ] ) How do we make sure that sign is positive? A: Test, and flip if needed ( A= -A, B= -B, C= -C ) So…we can find edge equation from two verts. Given three corners P 0, P 1, P 2 of a triangle, what are our three edges? How do we make sure the half-spaces defined by the edge equations all share the same sign on the interior of the triangle? A: Be consistent (Ex: [P 0 P 1 ], [P 1 P 2 ], [P 2 P 0 ] ) How do we make sure that sign is positive? A: Test, and flip if needed ( A= -A, B= -B, C= -C )

Edge Equations: Code Basic structure of code: Setup: compute edge equations, bounding boxSetup: compute edge equations, bounding box (Outer loop) For each scanline in bounding box...(Outer loop) For each scanline in bounding box... (Inner loop) …check each pixel on scanline, evaluating edge equations and drawing the pixel if all three are positive(Inner loop) …check each pixel on scanline, evaluating edge equations and drawing the pixel if all three are positive Basic structure of code: Setup: compute edge equations, bounding boxSetup: compute edge equations, bounding box (Outer loop) For each scanline in bounding box...(Outer loop) For each scanline in bounding box... (Inner loop) …check each pixel on scanline, evaluating edge equations and drawing the pixel if all three are positive(Inner loop) …check each pixel on scanline, evaluating edge equations and drawing the pixel if all three are positive

Optimize This! findBoundingBox(&xmin, &xmax, &ymin, &ymax); setupEdges (&a0,&b0,&c0,&a1,&b1,&c1,&a2,&b2,&c2); /* Optimize this: */ for (int y = yMin; y <= yMax; y++) { for (int x = xMin; x <= xMax; x++) { float e0 = a0*x + b0*y + c0; float e1 = a1*x + b1*y + c1; float e2 = a2*x + b2*y + c2; if (e0 > 0 && e1 > 0 && e2 > 0) setPixel(x,y); }} findBoundingBox(&xmin, &xmax, &ymin, &ymax); setupEdges (&a0,&b0,&c0,&a1,&b1,&c1,&a2,&b2,&c2); /* Optimize this: */ for (int y = yMin; y <= yMax; y++) { for (int x = xMin; x <= xMax; x++) { float e0 = a0*x + b0*y + c0; float e1 = a1*x + b1*y + c1; float e2 = a2*x + b2*y + c2; if (e0 > 0 && e1 > 0 && e2 > 0) setPixel(x,y); }}

Edge Equations: Speed Hacks Some speed hacks for the inner loop: int xflag = 0; for (int x = xMin; x <= xMax; x++) { if (e0|e1|e2 > 0) { setPixel(x,y);xflag++; } else if (xflag != 0) break; e0 += a0; e1 += a1; e2 += a2; } Incremental update of edge equation values (think DDA)Incremental update of edge equation values (think DDA) Early termination (why does this work?)Early termination (why does this work?) Faster test of equation valuesFaster test of equation values Some speed hacks for the inner loop: int xflag = 0; for (int x = xMin; x <= xMax; x++) { if (e0|e1|e2 > 0) { setPixel(x,y);xflag++; } else if (xflag != 0) break; e0 += a0; e1 += a1; e2 += a2; } Incremental update of edge equation values (think DDA)Incremental update of edge equation values (think DDA) Early termination (why does this work?)Early termination (why does this work?) Faster test of equation valuesFaster test of equation values

Triangle Rasterization Issues Exactly which pixels should be lit? A: Those pixels inside the triangle edges What about pixels exactly on the edge? Draw them: order of triangles matters (it shouldn’t)Draw them: order of triangles matters (it shouldn’t) Don’t draw them: gaps possible between trianglesDon’t draw them: gaps possible between triangles We need a consistent (if arbitrary) rule Example: draw pixels on left or top edge, but not on right or bottom edgeExample: draw pixels on left or top edge, but not on right or bottom edge Exactly which pixels should be lit? A: Those pixels inside the triangle edges What about pixels exactly on the edge? Draw them: order of triangles matters (it shouldn’t)Draw them: order of triangles matters (it shouldn’t) Don’t draw them: gaps possible between trianglesDon’t draw them: gaps possible between triangles We need a consistent (if arbitrary) rule Example: draw pixels on left or top edge, but not on right or bottom edgeExample: draw pixels on left or top edge, but not on right or bottom edge

General Polygon Rasterization Now that we can rasterize triangles, what about general polygons? We’ll take an edge-walking approach Now that we can rasterize triangles, what about general polygons? We’ll take an edge-walking approach

Triangle Rasterization Issues SliverSliver

Moving Slivers Triangle Rasterization Issues

Shared Edge Ordering

General Polygon Rasterization Consider the following polygon: How do we know whether a given pixel on the scanline is inside or outside the polygon? Consider the following polygon: How do we know whether a given pixel on the scanline is inside or outside the polygon? A B C D E F

Polygon Rasterization Inside-Outside Points

Polygon Rasterization Inside-Outside Points

General Polygon Rasterization Basic idea: use a parity test for each scanline edgeCnt = 0; edgeCnt = 0; for each pixel on scanline (l to r) for each pixel on scanline (l to r) if (oldpixel->newpixel crosses edge) if (oldpixel->newpixel crosses edge) edgeCnt ++; edgeCnt ++; // draw the pixel if edgeCnt odd // draw the pixel if edgeCnt odd if (edgeCnt % 2) if (edgeCnt % 2) setPixel(pixel); setPixel(pixel); Basic idea: use a parity test for each scanline edgeCnt = 0; edgeCnt = 0; for each pixel on scanline (l to r) for each pixel on scanline (l to r) if (oldpixel->newpixel crosses edge) if (oldpixel->newpixel crosses edge) edgeCnt ++; edgeCnt ++; // draw the pixel if edgeCnt odd // draw the pixel if edgeCnt odd if (edgeCnt % 2) if (edgeCnt % 2) setPixel(pixel); setPixel(pixel);

General Polygon Rasterization Count your vertices carefully If exactly on pixel boundary?If exactly on pixel boundary? Shared vertices?Shared vertices? Vertices defining horizontal edge?Vertices defining horizontal edge? –Consider A-B versus I-H Count your vertices carefully If exactly on pixel boundary?If exactly on pixel boundary? Shared vertices?Shared vertices? Vertices defining horizontal edge?Vertices defining horizontal edge? –Consider A-B versus I-H B C D E FG I H J A

Faster Polygon Rasterization How can we optimize the code? for each scanline edgeCnt = 0; edgeCnt = 0; for each pixel on scanline (l to r) for each pixel on scanline (l to r) if (oldpixel->newpixel crosses edge) if (oldpixel->newpixel crosses edge) edgeCnt ++; edgeCnt ++; // draw the pixel if edgeCnt odd // draw the pixel if edgeCnt odd if (edgeCnt % 2) if (edgeCnt % 2) setPixel(pixel); setPixel(pixel); Big cost: testing pixels against each edge Solution: active edge table (AET) How can we optimize the code? for each scanline edgeCnt = 0; edgeCnt = 0; for each pixel on scanline (l to r) for each pixel on scanline (l to r) if (oldpixel->newpixel crosses edge) if (oldpixel->newpixel crosses edge) edgeCnt ++; edgeCnt ++; // draw the pixel if edgeCnt odd // draw the pixel if edgeCnt odd if (edgeCnt % 2) if (edgeCnt % 2) setPixel(pixel); setPixel(pixel); Big cost: testing pixels against each edge Solution: active edge table (AET)

Active Edge Table Idea: Edges intersecting a given scanline are likely to intersect the next scanlineEdges intersecting a given scanline are likely to intersect the next scanline The order of edge intersections doesn’t change much from scanline to scanlineThe order of edge intersections doesn’t change much from scanline to scanlineIdea: Edges intersecting a given scanline are likely to intersect the next scanlineEdges intersecting a given scanline are likely to intersect the next scanline The order of edge intersections doesn’t change much from scanline to scanlineThe order of edge intersections doesn’t change much from scanline to scanline

Active Edge Table Algorithm: scanline from bottom to top… Sort all edges by their minimum y coordSort all edges by their minimum y coord Starting at bottom, add edges with Y min = 0 to AETStarting at bottom, add edges with Y min = 0 to AET For each scanline:For each scanline: –Sort edges in AET by x intersection –Walk from left to right, setting pixels by parity rule –Increment scanline –Retire edges with Y max < Y –Add edges with Y min < Y –Recalculate edge intersections (how?) Stop when Y > Y max for last edgesStop when Y > Y max for last edges Algorithm: scanline from bottom to top… Sort all edges by their minimum y coordSort all edges by their minimum y coord Starting at bottom, add edges with Y min = 0 to AETStarting at bottom, add edges with Y min = 0 to AET For each scanline:For each scanline: –Sort edges in AET by x intersection –Walk from left to right, setting pixels by parity rule –Increment scanline –Retire edges with Y max < Y –Add edges with Y min < Y –Recalculate edge intersections (how?) Stop when Y > Y max for last edgesStop when Y > Y max for last edges