Image Synthesis Rabie A. Ramadan, PhD 7. 2 Image Rasterization.

Slides:



Advertisements
Similar presentations
Graphics Primitives: line
Advertisements

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.
1 King ABDUL AZIZ University Faculty Of Computing and Information Technology CS 454 Computer graphics Drawing Elementary Figures Dr. Eng. Farag Elnagahy.
CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE.
+ CPCS 391 Computer Graphics 1 Instructor: Dr. Sahar Shabanah Lecture 3.
Scan conversion of Line , circle & ellipse
Line Drawing Algorithms. Rasterization-Process of determining which pixels give the best approximation to a desired line on the screen. Scan Conversion-Digitizing.
Larry F. Hodges (modified by Amos Johnson) 1 Design of Line, Circle & Ellipse Algorithms.
30/9/2008Lecture 21 Computer Graphics Assistant Professor Dr. Sana’a Wafa Al-Sayegh 2 nd Semester ITGD3107 University of Palestine.
OUTPUT PRIMITIVES Screen vs. World coordinate systems ● Objects positions are specified in a Cartesian coordinate system called World Coordinate.
Raster conversion algorithms for line and circle
Output Primitives Computer Graphics.
CS5500 Computer Graphics © Chun-Fa Chang, Spring 2007 CS5500 Computer Graphics May 3, 2007.
Implementation III Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Course Website: Computer Graphics 5: Line Drawing Algorithms.
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Scan Conversion CS123 1 of 44Scan Conversion - 10/14/2014.
CS 450: COMPUTER GRAPHICS DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE.
Rasterizing primitives: know where to draw the line Dr Nicolas Holzschuch University of Cape Town Modified.
Dr. S.M. Malaek Assistant: M. Younesi
Jehee Lee Seoul National University
Graphics Primitives: line. Pixel Position
WHERE TO DRAW A LINE?? Line drawing is accomplished by calculating intermediate positions along the line path between specified end points. Precise definition.
Scan Conversion Line and Circle
Triangle Scan Conversion. 2 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Rasterization Rasterization (scan conversion) –Determine which.
1Computer Graphics Implementation III Lecture 17 John Shearer Culture Lab – space 2
Introduction to Computer Graphics with WebGL
CS 480/680 Computer Graphics Implementation III Dr. Frederick C Harris, Jr. Fall 2011.
Introduction Computer Graphics & Its application Types of computer graphics Graphic display : random Scan & Raster Scan display Frame buffer and video.
Graphics Output Primitives
CGMB214: Introduction to Computer Graphics
 A line segment in a scene is defined by the coordinate positions of the line end-points x y (2, 2) (7, 5)
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
MIDPOINT CIRCLE & ELLIPSE GENERARTING ALGORITHMS
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.
10/19/04© University of Wisconsin, CS559 Fall 2004 Last Time Clipping –Why we care –Sutherland-Hodgman –Cohen-Sutherland –Intuition for Liang-Barsky Homework.
1 CSCE 441 Lecture 2: Scan Conversion of Lines Jinxiang Chai.
GEOMETRY AND LINE GENERATION Geometry and Line Generation Chapter 2.
MIT EECS 6.837, Durand and Cutler The Graphics Pipeline: Line Clipping & Line Rasterization.
Lecture 13: Raster Graphics and Scan Conversion
OUTPUT PRIMITIVES A.Aruna/Faculty of Information technology/SNSCE13/19/2016.
Lecture 2: 19/4/1435 Graphical algorithms Lecturer/ Kawther Abas CS- 375 Graphics and Human Computer Interaction.
Computer Graphics : Bresenham Line Drawing Algorithm, Circle Drawing
Computer Graphics CC416 Lecture 04: Bresenham Line Algorithm & Mid-point circle algorithm Dr. Manal Helal – Fall 2014.
Write Bresenham’s algorithm for generation of line also indicate which raster locations would be chosen by Bresenham’s algorithm when scan converting.
Computer Graphics Inf4/MSc Computer Graphics Lecture 4 Line & Circle Drawing.
10/10/2006TCSS458A Isabelle Bichindaritz1 Line and Circle Drawing Algorithms.
Scan Conversion of Line Segments. What is Scan conversion? Final step of rasterization (the process of taking geometric shapes and converting them into.
Computer Graphics I, Fall 2010 Scan conversion algorithms.
Line Drawing Algorithms 1. A line in Computer graphics is a portion of straight line that extends indefinitely in opposite direction. 2. It is defined.
OUTPUT PRIMITIVES CEng 477 Computer Graphics METU, 2004.
Objectives Understand Bresenhams line drawing algorithm. Apply the algorithm to plot a line with the end points specified.
Primitive graphic objects
CSCE 441 Lecture 2: Scan Conversion of Lines
Computer graphics 2D graphics.
CS 4731: Computer Graphics Lecture 20: Raster Graphics Part 1
Lecture 8 Shear and Line Drawing Algorithms
University of New Mexico
Implementation III.
Chapter Three Part I Output Primitives CS 380.
Introduction to Computer Graphics with WebGL
CSCE 441 Lecture 2: Scan Conversion of Lines
Rasterization and Antialiasing
Computer Graphics Implementation III
Rasterization and Antialiasing
Chapter 3 Graphics Output Primitives
Implementation III Ed Angel Professor Emeritus of Computer Science
Line Drawing Algorithms
OUTPUT PRIMITIVES / DISPLAY TECHNIQUES
Presentation transcript:

Image Synthesis Rabie A. Ramadan, PhD 7

2 Image Rasterization

3 Rasterization and Fragment Processing A precise sequence of steps for converting primitives into patterns of pixel values in the framebuffer. Digital images created or captured (for example, by scanning in a photo) as a set of samples of a given space.

4 The graphics pipeline

5 Pipeline overview

6 Primitives

7 Rasterization First job: enumerate the pixels covered by a primitive Simple, aliased definition: pixels whose centers fall inside Second job: interpolate values across the primitive e.g., colors computed at vertices Will see applications later on

8 Rasterizing lines

9 Point sampling

10 Point sampling in action

Pixel addressing in raster graphics

Raster conversion algorithms: requirements visual accuracy speed

Line drawing algorithms

Line – raster representation

How does computer draw line? Screen made of pixels High-level language specifies line System must color pixels

Naïve algorithm for lines Line definition: ax+by+c = 0 Also expressed as: y = mx + d m = slope d = distance For x=xmin to xmax compute y = m*x+d light pixel (x,y)

Extension by symmetry Only works with -1  m  1: m = 1/3 m = 3 Extend by symmetry for m > 1

Problems 2 floating-point operations per pixel Improvements: compute y = m*p+d For x=xmin to xmax y += m light pixel (x,y) Still 1 floating-point operation per pixel Compute in floats, pixels in integers

DDA ( Digital Differential Algorithm ) m < 1

DDA ( Digital Differential Algorithm ) m > 1

DDA ( Digital Differential Algorithm ) m > 1

Digital Differential Algorithm input line endpoints, (x 0,y 0 ) and (x n, y n ) set pixel at position (x 0,y 0 ) calculate slope m Case |m|≤1: repeat the following steps until (x n, y n ) is reached: y i+1 = y i +  y/  x x i+1 = x i + 1 set pixel at position (x i+1,Round(y i+1 )) Case |m|>1: repeat the following steps until (x n, y n ) is reached: x i+1 = x i +  x/  y y i+1 = y i + 1 set pixel at position (Round(x i+1 ), y i+1 )

Bresenham's line algorithm d1 d2 xx+1 y y = m(x+1) + b y = mx + b

Bresenham's line algorithm (slope ≤ 1) input line endpoints, (x 0,y 0 ) and (x n, y n ) calculate  x = x n - x 0 and  y = y n - y 0 calculate parameter p 0 = 2  y -  x set pixel at position (x 0,y 0 ) repeat the following steps until (x n, y n ) is reached: if p i < 0 set the next pixel at position (x i +1, y i ) calculate new p i+1 = p i + 2  y if p i ≥ 0 set the next pixel at position (x i +1, y i + 1 ) calculate new p i+1 = p i + 2(  y -  x)

DDA versus Bresenham’s Algorithm DDA works with floating point arithmetic Rounding to integers necessary Bresenham’s algorithm uses integer arithmetic Constants need to be computed only once Bresenham’s algorithm generally faster than DDA

Circle: naïve algorithm Circle equation: x 2 +y 2 -r 2 = 0 Simple algorithm: for x = xmin to xmax y = sqrt(r*r - x*x) draw pixel(x,y) Work by octants and use symmetry

Circle: Bresenham algorithm Choice between two pixels: Circle drawn so far …or that one Either I lit this pixel…