Computer Graphics. Rasterization. Teacher: A.prof. Chengying Gao( 高成英 ) School of Data and Computer Science

Similar documents
COMP371 COMPUTER GRAPHICS

Graphics (Output) Primitives. Chapters 3 & 4

Computer Graphics. - Rasterization - Philipp Slusallek

Line Drawing. Introduction to Computer Graphics Torsten Möller / Mike Phillips. Machiraju/Zhang/Möller

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

Chapter - 2: Geometry and Line Generations

From Ver(ces to Fragments: Rasteriza(on

Computer Graphics D Graphics Algorithms

The Traditional Graphics Pipeline

Rasterization: Geometric Primitives

CS 543: Computer Graphics. Rasterization

Computer Graphics D Graphics Algorithms

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

Computer Graphics Geometry and Transform

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

The Traditional Graphics Pipeline

The Traditional Graphics Pipeline

CS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines. Emmanuel Agu

Line Drawing. Foundations of Computer Graphics Torsten Möller

Einführung in Visual Computing

Scan Conversion. Drawing Lines Drawing Circles

Pipeline implementation II

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

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

CS 4300 Computer Graphics. Prof. Harriet Fell Fall 2012 Lecture 5 September 13, 2012

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

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

Computer Graphics Geometry and Transform

RASTERIZING POLYGONS IN IMAGE SPACE

EF432. Introduction to spagetti and meatballs

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

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

Chapter 8: Implementation- Clipping and Rasterization

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

Scan Conversion. CMP 477 Computer Graphics S. A. Arekete

Prof. Feng Liu. Fall /25/2018

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

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

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

0. Introduction: What is Computer Graphics? 1. Basics of scan conversion (line drawing) 2. Representing 2D curves

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

CS 325 Computer Graphics

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

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

Anti-aliased and accelerated ray tracing. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell

Surface shading: lights and rasterization. Computer Graphics CSE 167 Lecture 6

Rasterization. CS4620/5620: Lecture 12. Announcements. Turn in HW 1. PPA 1 out. Friday lecture. History of graphics PPA 1 in 4621.

Anti-aliased and accelerated ray tracing. University of Texas at Austin CS384G - Computer Graphics

Realtime 3D Computer Graphics Virtual Reality

Display Technologies: CRTs Raster Displays

UNIT -8 IMPLEMENTATION

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

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

In today s lecture we ll have a look at: A simple technique The mid-point circle algorithm

SE Mock Online Test 1-CG

Computer Graphics : Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling

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

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

Painter s HSR Algorithm

EF432. Introduction to spagetti and meatballs

CS 130 Final. Fall 2015

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

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

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Institutionen för systemteknik

CHAPTER 1 Graphics Systems and Models 3

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

Rasterization. COMP 575/770 Spring 2013

Rasteriza2on and Clipping

Rasterization. CS 4620 Lecture Kavita Bala w/ prior instructor Steve Marschner. Cornell CS4620 Fall 2015 Lecture 16

Graphics Output Primitives

CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE

Topic 0. Introduction: What Is Computer Graphics? CSC 418/2504: Computer Graphics EF432. Today s Topics. What is Computer Graphics?

Clipping and Scan Conversion

Last Time: Acceleration Data Structures for Ray Tracing. Schedule. Today. Shadows & Light Sources. Shadows

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

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

Scan line algorithm. Jacobs University Visualization and Computer Graphics Lab : Graphics and Visualization 272

Last time? Rasterization. Scan Conversion (Rasterization) High-level concepts for Visibility / Display. Today

Unit 2 Output Primitives and their Attributes

CS Rasterization. Junqiao Zhao 赵君峤

Rasterization and Graphics Hardware. Not just about fancy 3D! Rendering/Rasterization. The simplest case: Points. When do we care?

Rasterization. CS4620 Lecture 13

Pipeline and Rasterization. COMP770 Fall 2011

Write C++/Java program to draw line using DDA and Bresenham s algorithm. Inherit pixel class and Use function overloading.

Output Primitives. Dr. S.M. Malaek. Assistant: M. Younesi

Computer Graphics. Lecture 2. Doç. Dr. Mehmet Gokturk

(a) rotating 45 0 about the origin and then translating in the direction of vector I by 4 units and (b) translating and then rotation.

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

Course Title: Computer Graphics Course no: CSC209

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

The graphics pipeline. Pipeline and Rasterization. Primitives. Pipeline

CS2401 COMPUTER GRAPHICS ANNA UNIV QUESTION BANK

CS559: Computer Graphics. Lecture 12: Antialiasing & Visibility Li Zhang Spring 2008

Spring 2012 Final. CS184 - Foundations of Computer Graphics. University of California at Berkeley

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

For this assignment, you are to implement three line drawers and a polygon drawer.

Chapter 3. Sukhwinder Singh

Topic #1: Rasterization (Scan Conversion)

Transcription:

Rasterization Teacher: A.prof. Chengying Gao( 高成英 ) E-mail: mcsgcy@mail.sysu.edu.cn School of Data and Computer Science

To make an image, we can... Drawing Photography 2

Two Ways to Render an Image In CG, drawing is... Photography is... Rasterization Ray Tracing 3

Screen 4

Sensors 真实物理世界没有颜色的概念, 只有频率 颜色只是人的主观感受, 不是物体的客观属性, 物体只是在发射或反射电磁波 5

Rasterization The task of displaying a world modeled using primitives like lines, polygons, filled/patterned area, etc. can be carried out in two steps: determine the pixels through which the primitive is visible, determine the color value to be assigned to each such pixel 6

Raster Graphics Packages The efficiency of these steps forms the main criteria to determine the performance of a display The raster graphics package is typically a collection of efficient algorithms for scan converting (rasterization) of the display primitives High performance graphics workstations have most of these algorithms implemented in hardware Comparison of raster graphics editors: https://en.wikipedia.org/wiki/comparison_of_raster_graphics_editors 7

Rasterization To convert vector data to raster format Scan Conversion:Figure out which pixel should to shade. 8

Scan converting lines 9

Scan converting lines 10

Scan converting lines 11

Scan converting lines 12

Scan converting lines 13

Scan converting lines 14

Scan converting lines 15

Scan converting lines 16

Equation of Line 17

Digital Differential Analyzer (DDA, 数值微分法 ) 18

Digital Differential Analyzer (DDA, 数值微分法 ) 19

Digital Differential Analyzer (DDA, 数值微分法 ) 20

Digital Differential Analyzer (DDA) 21

Digital Differential Analyzer (DDA) 22

Digital Differential Analyzer (DDA) 23

Digital Differential Analyzer (DDA) 24

Digital Differential Analyzer (DDA) 25

Digital Differential Analyzer (DDA) y += 1, x += 1/m 26

Digital Differential Analyzer (DDA) y += 1, x += 1/m 27

Digital Differential Analyzer (DDA) y += 1, x += 1/m 28

Digital Differential Analyzer (DDA) y += 1, x += 1/m 29

Digital Differential Analyzer (DDA) y += 1, x += 1/m 30

Digital Differential Analyzer (DDA) Divide and conquer! y += 1, x += 1/m 31

DDA Algorithm 32

Bresenham s algorithm ( 布兰森汉姆算法 ) Introduced in 1967 by J. Bresenham of IBM Best-fit approximation under some conditions In DDA, only y i is used to compute y i +1, the information for selecting the pixel is neglected Bresenham algorithm employs the information to constrain the position of the next pixel 33

Notations The line segment is from to Denote Assume that slope Like DDA algorithm, Bresenham Algorithm also starts from and increases x coordinate by 1 each time Suppose the i-th point is Then the next point can only be one of the following two 34

Criteria( 判别标准 ) We will choose one which distance to the following intersection is shorter 35

Computation of Criteria The distances are respectively 36

Computation of Criteria division operation 37

Restatement of the Criteria 38

Recursive for computation of p i 39

Summary of Bresenham Algorithm 40

Example Draw line segment (3,4)-(8,7) 41

(Continued) 0 1 (4,5) 1-3 (5,5) 2 3 (6,6) 3-1 (7,6) 4 5 (8,7) 注 : 8 7 6 5 4 3 2 2 3 4 5 6 7 8

More Raster Line Issues The coordinates of endpoints are not integer Generalize to draw other primitives: circles, ellipsoids Line pattern and thickness? 44

3D Bresenham algorithm 45

What Makes a Good Line? Not too jaggy Uniform thickness of lines at different angles Symmetry, Line(P,Q) = Line(Q,P) A good line algorithm should be fast. 46

Line Attributes line width dash patterns end caps: butt, round, square 47

Line Attributes Joins: round, bevel, miter 48

Scan conversion of circles 49

Polygon Rasterization 50

Scan conversion of polygon Polygon representation Polygon filling: vertex representation lattice representation 51

Polygon filling fill a polygonal area --> test every pixel in the raster to see if it lies inside the polygon. 52

Inside Check 53

Scan-line Methods Makes use of the coherence properties Spatial coherence : Except at the boundary edges, adjacent pixels are likely to have the same characteristics Scan line coherence : Pixels in the adjacent scan lines are likely to have the same characteristics Uses intersections between area boundaries and scan lines to identify pixels that are inside the area 54

Scan Line Method Proceeding from left to right the intersections are paired and intervening pixels are set to the specified intensity Algorithm Find the intersections of the scan line with all the edges in the polygon Sort the intersections by increasing X-coordinates Fill the pixels between pair of intersections From top to down Discussion : How to speed up, or how to avoid calculating intersection 55

Efficiency Issues Scan-line Methods 56

Special cases for Scan-line Methods 57

Advantages of Scan Line method The algorithm is efficient Each pixel is visited only once Shading algorithms could be easily integrated with this method to obtain shaded area Efficient could be further improved if polygons are convex Much better if they are only triangles 58

What is Convex? 59

Convex Polygon Rasterization 60

Triangle Rasterization 61

Edge Walking 62

Edge Walking 63

Edge Walking Triangle 64

12

Edge Walking 66

Edge Equations 67

Edge Equations 68

Edge Equations 69

Aliasing 70

Aliasing A classic part of the computer graphics curriculum Input: (x2, y2) Line segment definition (x1, y1), (x2, y2) Output: List of pixels (x1, y1) 71

Aliasing How Do They Look? So now we know how to draw lines But they don t look very good: 72

Antialiasing 73

Anti-aliasing Application of techniques to reduce/eliminate aliasing artifacts. Essentially 3 techniques: Super-sampling vs. filter We discussed a simple averaging filter Compute the fraction of a line that should be applied to a pixel Ratio method Area Simpling 74

Anti-aliasing: Super-sampling Technique: 1. Create an image 2x (or 4x, or 8x) bigger than the real image 2. Scale the line endpoints accordingly 3. Draw the line as before No change to line drawing algorithm 4. Average each 2x2 (or 4x4, or 8x8) block into a single pixel 75

Anti-aliasing: Super-sampling 1/4 2/4 2/4 1/4 No antialiasing 2x2 Supersampled Downsampled to original size 76

Anti-aliasing: Ratios 77

Anti-aliasing: Ratios 78

Anti-aliasing (Area Sampling) 79