Polygon Filling. Can write frame buffer one word at time rather than one bit. 2/3/2000 CS 4/57101 Lecture 6 1

Similar documents
2D Graphics Primitives II. Additional issues in scan converting lines. 1)Endpoint order. Want algorithms to draw the same pixels for each line

Chapter 3. Sukhwinder Singh

CS488 2D Graphics. Luc RENAMBOT

Announcements. Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class. Computer Graphics

8. Hidden Surface Elimination

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

Incremental Form. Idea. More efficient if we look at d k, the value of the decision variable at x = k

Scan Conversion of Polygons. Dr. Scott Schaefer

Agenda. Polygon Terminology Types of polygons Inside Test Polygon Filling Algorithms. Scan-Line Polygon Fill Algorithm Flood-Fill Algorithm

CS 325 Computer Graphics

Graphics (Output) Primitives. Chapters 3 & 4

Computer Graphics 7 - Rasterisation

COMP371 COMPUTER GRAPHICS

Computer Graphics. - Rasterization - Philipp Slusallek

Chapter 8: Implementation- Clipping and Rasterization

Rasterizing triangles

8. Hidden Surface Elimination

(Refer Slide Time: 00:02:00)

Rasterization, or What is glbegin(gl_lines) really doing?

Computer Graphics - Week 6

Fall CSCI 420: Computer Graphics. 7.1 Rasterization. Hao Li.

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

CS 4731/543: Computer Graphics Lecture 7 (Part I): Raster Graphics: Polygons & Antialiasing. Emmanuel Agu

CSCI 420 Computer Graphics Lecture 14. Rasterization. Scan Conversion Antialiasing [Angel Ch. 6] Jernej Barbic University of Southern California

Rasterization. Rasterization (scan conversion) Digital Differential Analyzer (DDA) Rasterizing a line. Digital Differential Analyzer (DDA)

Computer Graphics (CS 543) Lecture 10: Rasterization and Antialiasing

Attributes of Graphics Primitives

CS 543: Computer Graphics. Rasterization

OpenGL Graphics System. 2D Graphics Primitives. Drawing 2D Graphics Primitives. 2D Graphics Primitives. Mathematical 2D Primitives.

Einführung in Visual Computing

Computer Graphics CS 543 Lecture 11 (Part 1) Polygon Filling & Antialiasing

Raster Displays and Scan Conversion. Computer Graphics, CSCD18 Fall 2008 Instructor: Leonid Sigal

Computer Graphics. Chapter 4 Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1

Unit 2 Output Primitives and their Attributes

CS 248 Assignment 2 Polygon Scan Converter. CS248 Presented by Abe Davis Stanford University October 17, 2008

Scan Conversion. Drawing Lines Drawing Circles

Topic #1: Rasterization (Scan Conversion)

Filled Area Primitives. CEng 477 Introduction to Computer Graphics METU, 2007

Computer Engineering and Intelligent Systems ISSN (Paper) ISSN (Online) Vol.5, No.4, 2014

Computer Graphics. Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1

Werner Purgathofer

Topics. From vertices to fragments

Line Arrangement. Chapter 6

Page 1. Area-Subdivision Algorithms z-buffer Algorithm List Priority Algorithms BSP (Binary Space Partitioning Tree) Scan-line Algorithms

RASTERIZING POLYGONS IN IMAGE SPACE

Triangle Rasterization

R asterisation. Part I: Simple Lines. Affine transformation. Transform Render. Rasterisation Line Rasterisation 2/16

Computer Graphics Geometry and Transform

CSCI 4620/8626. Primitives and Attributes

CMSC 435 Introductory Computer Graphics Pipeline. Announcements

1 Introduction to Graphics

Rasteriza2on and Clipping

Text in OpenGL and Windows. Computer Graphics Attributes. Computer Graphics. Binghamton University. EngiNet. Thomas J. Watson

Visible Surface Detection Methods

Introduction Rasterization Z-buffering Shading. Graphics 2012/2013, 4th quarter. Lecture 09: graphics pipeline (rasterization and shading)

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

CS184 : Foundations of Computer Graphics Professor David Forsyth Final Examination

? Which intermediate. Recall: Line drawing algorithm. Programmer specifies (x,y) of end pixels Need algorithm to determine pixels on line path

Visible-Surface Detection Methods. Chapter? Intro. to Computer Graphics Spring 2008, Y. G. Shin

SE Mock Online Test 1-CG

Lecture 2 October 31, 2005

CS184 : Foundations of Computer Graphics Professor David Forsyth Final Examination (Total: 100 marks)

Clipping and Scan Conversion

Elementary Planar Geometry

Renderer Implementation: Basics and Clipping. Overview. Preliminaries. David Carr Virtual Environments, Fundamentals Spring 2005

Image Morphing. The user is responsible for defining correspondences between features Very popular technique. since Michael Jackson s clips

Triangle Fast Scan-Conversion Algorithm Report

521493S Computer Graphics Exercise 1 (Chapters 1-3)

Chapter - 2: Geometry and Line Generations

Rendering. Basic Math Review. Rasterizing Lines and Polygons Hidden Surface Remove Multi-pass Rendering with Accumulation Buffers.

Rasterization. COMP 575/770 Spring 2013

Outline. Scanline conversion Incremental updates Edge table and active edge table. Gouraud shading Phong interpolation

CS452/552; EE465/505. Clipping & Scan Conversion

CS602 Midterm Subjective Solved with Reference By WELL WISHER (Aqua Leo)

VERTICAL SCAN-CONVERSION FOR FILLING PURPOSES

CS130 : Computer Graphics Lecture 2: Graphics Pipeline. Tamar Shinar Computer Science & Engineering UC Riverside

General Hidden Surface Removal Algorithms. Binghamton University. EngiNet. Thomas J. Watson. School of Engineering and Applied Science CS 460/560

Rasterization Computer Graphics I Lecture 14. Scan Conversion Antialiasing Compositing [Angel, Ch , ]

CS6100: Topics in Design and Analysis of Algorithms

Last class. A vertex (w x, w y, w z, w) - clipping is in the - windowing and viewport normalized view volume if: - scan conversion/ rasterization

Polygon Partitioning. Lecture03

CSCI 4620/8626. Coordinate Reference Frames

Pipeline implementation II

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Graphics Output Primitives

Line segment intersection. Family of intersection problems

Visible Surface Detection. (Chapt. 15 in FVD, Chapt. 13 in Hearn & Baker)

2D Image Synthesis. 2D image synthesis. Raster graphics systems. Modeling transformation. Vectorization. u x u y 0. o x o y 1

CS-184: Computer Graphics. Today. 2D Scan Conversion. Tuesday, October 7, Drawing Lines Drawing Curves Filled Polygons Filling Algorithms

CS-184: Computer Graphics

Implementation III. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

CS 410/584, Algorithm Design & Analysis, Lecture Notes 8!

Shading. Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller/Fuhrmann

Clipping. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Scan Converting Text. Attributes of Output Primitives. CS 460/560 Computer Graphics. Binghamton University. EngiNet. Thomas J.

CS 532: 3D Computer Vision 11 th Set of Notes

From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored.

CS4620/5620: Lecture 14 Pipeline

Intro to Modeling Modeling in 3D

Computer Graphics Geometry and Transform

Transcription:

Polygon Filling 2 parts to task which pixels to fill what to fill them with First consider filling unclipped primitives with solid color Which pixels to fill consider scan lines that intersect primitive fill in spans of pixels lying inside primitive exploit spatial coherence, span coherence, scan-line coherence, edge coherence Can write frame buffer one word at time rather than one bit 2/3/2000 CS 4/57101 Lecture 6 1

Line Segments Sharing Pixels Important not to write pixels twice could be set to background color if xor used could be double intensity (film writer) Is boundary part of an area defining primitive mathematically yes graphically more complicated Rule: left and bottom edges are part of primitive shared vertical edges belong to rightmost primitive Still problems bottom left point still drawn twice rectangles missing right and top edges!! 2/3/2000 CS 4/57101 Lecture 6 2

Polygon Types simple convex, simple concave, non-simple (selfintersecting) want no holes, no intersections (line crossings) rectangles and triangles always simple convex 2/3/2000 CS 4/57101 Lecture 6 3

Convex, Concave, Degenerate Convex polygons are preferable to concave Polygon is convex if for any two points inside polygon, the line segment joining these two points is also inside. Degeneracies 2/3/2000 CS 4/57101 Lecture 6 4

Polygon Representation Polygon Representation ordered list of vertices avoids redundant storage and computations associate other information with vertices colors, normals, textures 2/3/2000 CS 4/57101 Lecture 6 5

Scan Conversion Scan conversion: shade pixels lying within a closed polygon efficiently fill color will in general depend on the lighting, texture, and visibility of the polygon Assume polygon is closed and has ordered edges 2/3/2000 CS 4/57101 Lecture 6 6

Scan Conversion Algorithm intersect each scan-line with all edges sort intersections by increasing x coordinate calculate parity of intersections to determine in/out parity starts even - each intersection inverts fill the 'in' pixels - those with odd parity General issues - how to handle intersection at integer and fractional x values Special cases: shared vertices lying on scan-lines - double intersections count y min vertices but not y max vertices in parity count do NOT count vertices of horizontal edges 2/3/2000 CS 4/57101 Lecture 6 7

Fractional and Integer Intersections Fractional intersections if approaching intersection to the right to determine inside pixel take floor if inside, ceil if outside Integer intersections if leftmost pixel make interior, rightmost exterior 2/3/2000 CS 4/57101 Lecture 6 8

Shortening an edge 2/3/2000 CS 4/57101 Lecture 6 9

Using Spatial Coherence Efficiency can be improved by using spatial coherence Edges that intersect scan-line i are likely to intersect i+1 x i changes predictably from scan-line i to i+1 use an incremental algorithm that calculates the scanline extrema from extrema of previous scan line by using x i+1 = x i + 1/m where m is slope 2/3/2000 CS 4/57101 Lecture 6 10

Data Structures for Scan Conversion Edge Table: traverse edges eliminate horizontal edges if not local extremum, shorten upper vertex add edge to linked-list for the scanline corresponding to the lower vertex, storing: y_upper: last scanline x_lower: x coordinate of bottom endpoint 1/m: x increment 2/3/2000 CS 4/57101 Lecture 6 11

Data Structures for Scan Conversion Edge Table: eliminate horizontal edges sorted by smaller y coordinate use bucket sort with #buckets = #scan-lines in bucket order by increasing x- coordinate of lower endpoint add edge to linked-list for the scan-line corresponding to the lower vertex, storing: y_upper: last scanline to consider x_lower: starting x coordinate for edge 1/m: for incrementing x; compute before shortening 2/3/2000 CS 4/57101 Lecture 6 12

Data Structures for Scan Conversion Active Edge List (AEL) or Active Edge Table (AET) Linked list of active edges on the current scan-line, y sorted by their x intersection values. Fill spans defined by (suitably rounded pairs) Each active edge has the following information: y_upper: last scanline to consider x: edge's intersection with current y 1/m: for incrementing x When move to next scan-line y+1 update AEL remove those with y_upper = y add new edges with y_min = y+1 compute new x intersections 2/3/2000 CS 4/57101 Lecture 6 13

Scan Conversion Algorithm Start with smallest y coordinate - lowest bucket initialize AEL to empty repeat until AEL and ET are empty add edges in edge table with y_min=y to AEL if AEL <> NULL sort AEL by x - insertion or bubble sort fill pixels between edge pairs delete finished edges - y_upper=y increment y by 1 update each non-vertical edge's x using 1/m 2/3/2000 CS 4/57101 Lecture 6 14

Generalizations Slivers - thin areas whose interior does not contain distinct spans for each scan line missing pixels - a variant of the aliasing problem Multiple overlapping polygons Filling Ellipse Arcs Pattern Filling see Foley & van Dam 3.6 ; Hearn & Baker 3.11 2/3/2000 CS 4/57101 Lecture 6 15