Rasteriza2on and Clipping

Size: px
Start display at page:

Download "Rasteriza2on and Clipping"

Transcription

1 Overview Scan conversion Computer Graphics Rasterizaon and Clipping Polygon filling Clipping in D Aleksandra Pizurica Raster Display PIEL (picture element) RASTER (a rectangular array of points or dots) Scan Conversion SCAN LINE (a row of pixels) Asset: Control of every picture element (rich paoerns) Problem: limited resoluon 4 PloRng in a raster display Assume a bilevel display: each pixel is black or white Different paoerns of dots are created on the screen by serng each pixel to black or white (ie turning it on or off) A problem is that all the edges except perfectly horizontal and vercal ones show jaggies, ie, staircasing effect Line drawing 5

2 Line drawing: problem Line drawing: objecves A line segment is defined by its end points (x,y ) and (x,y ) with integer coordinates What is the best way to draw a line from the pixel (x,y ) to (x,y )? Such a line should ideally have the following properes Line drawing on a raster grid involves approximaon The process is called rasterizaon or scan- conversion pass through endpoints (appear) straight (appear) smooth independent of endpoint order uniform brightness slope- independent brightness efficient 7 8 Line drawing : brute force approach y (x i, y i ) What is wrong with this approach? x (x i, y i ) (x i, Round(y i )) Line Characterisa-on Explicit: y = mx + B Implicit: F(x,y) = ax + by + c = 0 Constant slope: Δy = m Δx The simplest strategy: ) Compute m; ) Increment x by starng with the leamost point; ) Calculate y i = mx i + B; 4) Intensify the pixel at (x i, Round(y i )), where Round(y i ) = Floor(05+y i ) 9 Line drawing: an incremental approach The previous approach is inefficient because each iteraon requires floang point operaon Mul%ply, Addi%on, and Floor We can eliminate the mulplicaon by nong that: yi+ = mxi + + B = m( xi + Δx) + B = yi + mδx If Δ x =, then y i+ = y i + m Thus, a unit of change in x changes y by m, which is the slope of the line A simple incremental algorithm (x i, y i ) (x i, Round(y i )) (x i +, Round(y i +m)) (x i +, y i +m) 0 Midpoint Line Algorithm: intro What is wrong with the incremental algorithm? Required floang- point operaons (Round) The me- consuming floang- point operaons are unnecessary because both endpoints are integers Bresenham (965) developed a classical algorithm that is aoracve because it uses only integer arithmec In Bresenham s algorithm, instead of incremenng y and then rounding it at each step, we just go to the right, or to the right and up using only integer quanes Midpoint Line Algorithm: idea Assume the line slope is m, 0 m, Previously selected pixel: P (x p, y p ) Choose between the pixel one increment to the right (the east pixel, E) or the pixel one increment to the right and one increment up (the northeast pixel, NE) Q: the intersecon point of the line being scan- converted with the grid line x = x p + M: the midpoint between E and NE If M lies above the line, pixel E is closer to the line; if M is below the line, pixel NE is closer to the line NE M E P = (x p, y p ) Q The problem becomes to decide on which side of the line the midpoint lies

3 Midpoint Line Algorithm: point posioning Midpoint Line Algorithm: decision variable () dy Explicit line form y = x + B gives: dx F( x, y) = x dy y dx + Bdx = 0 Comparing with the implicit form F( x, y) = ax + by + c = 0 yields a = dy, b = dx, and c = Bdx It can be shown that > 0 if (x,y) is below the line F( x, y) = 0 if (x,y) is on the line < 0 if (x,y) is above the line P (x,y ) P (x 0,y 0 ) dx=x x 0 dy=y-y0 Since we are trying to decide whether M lies below or above the line, we need only to compute F( M ) = F( x p +, y p + ) and to test its sign Define a decision variable d: P = (x p, y p ) NE d = F( xp +, y p + ) = a( xp + ) + b( y p + ) + c > 0, choose pixel NE = 0, choose pixel E < 0, choose pixel E M E Q 4 Midpoint Line Algorithm: decision variable () Midpoint Line Algorithm: decision variable () d old F( xp +, y + ) = p (x p, y p ) (x p +, y p +) (x p +, y p +) NE Q d M E (x p +, y p ) (x p +, y p ) F( xp +, y + ) = p If E is chosen, M is incremented by one step in the x direcon Then dnew = F( x p +, y p + ) = a( x p + ) + b( y p + ) + c = a( x p + ) + a + b( y p + ) + c = F( x p +, y p + ) + a = dold + a = dold + dy new On the other hand, if NE is chosen dnew = F( x p +, y p + ) = a( x p + ) + b( y p + ) + c = a( x p + ) + a + b( y p + ) + b + c = F( x p +, y p + ) + a + b = dold + a + b = dold + dy dx ( dnew dold ) = ΔNE = a + b = dy dx NE Inial condion: F ( x0 +, y0 + ) = a( x0 + ) + b( y0 + ) + c = F( x0, y0) + a + b/ ( d d ) = Δ = a dy new old E E = 5 d start = a + b/ = dy dx / 6 Midpoint Line Algorithm: summary () Start from the first endpoint, and the first decision variable is given by a+b/ Using d start, choose the second pixel, and so on At each step, choose between two pixels based on the sign of the decision variable d calculated in the previous iteraon Update the decision variable d by adding either Δ E or Δ NE to the old value, depending on the choice of the pixel *** Implementaon note: To eliminate the fracon in d start, the original F is mulplied by ; F(x,y) = (ax+by+c) This mulplies each constant in the decision variable (and the increments Δ E and Δ NE ) by Does not affect the sign of the decision variable, which is all that maoers for the midpoint test 7 Midpoint Line Algorithm: summary () Ini-alisa-on: d start = a + b = dy dx where dy = y y 0 and dx = x x 0 Incremental update: ) if E was chosen: Δ E = dy d new = d old + Δ E ) if NE was chosen: Δ NE = (dy dx) d new = d old + Δ NE Advantage: The arithmec needed to evaluate d new for any step is a simple integer addion No me- consuming mulplicaon involved The incremental update is quite simple, therefore An efficient algorithm Note: works for those line with slope (0, ) What about bigger slopes? 8

4 Line drawing: slope problem When the slope m is between 0 and we can step along x axis Other slopes can be handled by suitable reflecons around the principal axes Line drawing: Slope dependent intensity Problem: weaker intensity of diagonal lines Consider two scan- converted lines in the figure The diagonal line, B, has a slope of and hence is mes longer than the horizontal line A et the same number of pixels is drawn to represent each line If the intensity of each pixel is I, then the intensity per unit length of line A is I, whereas for line B it is only I / m <, can step along x m >, cannot step along x To handle this, apply a suitable reflecon Line B Line A 9 0 Scan converng circles Scan converng circles (-x,y) (x,y) (-y,x) (y,x) (-y,- x) (y,- x) (-x,- y) (x,- y) Suppose we want to rasterize a circle Think of a smart algorithm that makes use of the circle symmetry to avoid unnecessary computaons Which part of the circle do we need to scan convert, so that the rest follows by symmetry? Eight way symmetry: If the point (x,y) is on the circle, then we can trivially compute seven other points on this circle The midpoint circle scan conversion P (x p, y p ) M E SE Previous Choices for pixel current pixel M E M SE Choices for the next step if E or SE is chosen The midpoint circle scan conversion For a circle of radius R: F( x, y) = x + y R = 0 As for lines, the next pixel is chosen on the basis of the decision variable d, which is the value of the funcon at the midpoint dold = F( xp +, yp ) = ( xp + ) + ( yp ) R If d old < 0, E is chosen and we have dnew = F( xp +, yp ) = ( xp + ) + ( yp ) R resulng in Δ = x + E p If d old 0, SE is chosen and the new decision variable is dnew = F( xp +, yp ) = ( xp + ) + ( yp ) R and hence Δ = x + y + 5 SE p p 4

5 Scan converng ellipses The same reasoning can be applied for scan converng an ellipse, given by F( x, y) = b x + a y a b = 0 Division into four quadrants Two regions in the first quadrant E SE Tangent slope =- region region S SE Polygon filling 5 Polygons Vertex = point in space (D or D) Examples of polygons Polygon = ordered list of verces Each vertex is connected with the next one in the list The last vertex is connected with the first one A polygon can contain holes A polygon can also contain self- intersecons Simple polygon no holes or self- intersecons Such simple polygons are most interesng in Computer Graphics Efficient algorithms exist for polygon scan line rendering; this yields efficient algorithms for lighng, shading, texturing By using a sufficient number of polygons, we can get close to any reasonable shape 7 Simple Concave Convex Polygons Complex (self- intersecng) polygons 8 Drawing modes for polygons Polygon interior Draw lines along polygon edges Using eg midpoint line (Bresenham s) algorithm This is called wireframe mode Draw filled polygons Shaded polygons (shading modes) Flat shaded constant color for whole polygon Gouraud shaded interpolate vertex colors across the polygon We need to fill in (ie to color) only the pixels inside a polygon What is inside of a polygon? Parity (odd- even) rule commonly used Imagine a ray from the point to infinity Count the number of intersecons N with polygon edges If N is odd, the point is inside If N is even, the point is outside N = N = 4 N = 9 0

6 Polygon filling: scan line approach Span- filling is an important step in the whole polygon- filling algorithm, and is implemented by a three- step process: Find the intersecons of the scan line with all edges of the polygon Sort the intersecons by increasing x coordinates Fill in all pixels between pairs of intersecons that lie interior to the polygon Polygon filling: edge coherence How to find all intersecons between scan lines and edges? A brute- force technique would test each polygon edge against each new scan line This is inefficient and slow! A clever solu-on if an edge intersects with a scan line, and the slope of the edge is m, then successive scan line intersecons can be found from: x i+ = x i + /m span Edward Angel Interacve Computer Graphics where i is the scan line count Given that /m = (x x 0 )/(y y 0 ) the floang- point arithmec can be avoided by storing the numerator, comparing to the denominator, and incremenng x when it overflows How do we find and sort the intersecons efficiently? How do we judge whether a pixel is inside or outside the polygon? Span filling Rasterisation example (7) Scan line (0,0) START STOP START STOP O (0,0) P (,6) P (,0) P (7,0) P4 (4,) 4 Different ways of filling a polyline Alternave filling algorithms Parity rule Nonzero winding rule Nonexterior rule

7 Filled by parity rule Filling: winding rules + - Count the number of windings 0 Each region gets a winding index i Possible filling rules Fill with one color if i > 0 (non-zero winding fill) Fill with one color if mod (i, ) = 0 (parity fill) Fill with a separate color for each value of i Count the number of windings + - Clipping 0 0 Clip a line segment at the edges of a rectangular window Needs to be fast and robust Robust means: works for special cases too, and preferably in the same way as for the normal cases The method of Cohen- Sutherland (974) Very simple Suitable for hardware implementaon Can be directly extended to D Count the number of windings 4

8 Idea: Encode the posion of the end points with respect to lea, right, booom and top window edges and cut accordingly T B P (, ) P (, ) P (, ) P (, ) T B L P(,) Each endpoint is assigned a 4- bit code k = (k, k, k, k 4 ), k i {0,} and k = if < L (too much to the lea); k = if > R (too much to the right) k = if < B (too low) k 4 = if > T (too high) R O L R 4 Note: k and k cannot be simultaneously equal to, same holds for k and k 4 à Hence 9 possible code words (not 4 ) 44 k 4 = T k =k 4 =0 k=00 k=000 P(,) k k=000 k=0000 k=00 k=000 Cohen- Sutherland tries to solve first simple (trivial) cases Assign 4- bit code words to end points: P à k, P à k Step : if k = k = 0, P P is fully visible; otherwise go to Step Step : Find bit per bit logic AND: k=k ^k If k ^k 0, P P is fully and trivially non visible; otherwise go to Step B k = k=00 k=000 k=00 Step : find intersecons with lines extending from window edges; Go to Step O k = L k =k =0 R k = Trivially visible (k =k = 0) and trivially invisible ( k ^k 0) examples k 4 = T k =k 4 =0 B k = O 4 k=00 k=000 k=000 k=00 k=0000 k=000 k=00 k=000 k=00 5 k = L k =k =0 R k = 6 47 k ^k = 0, and not trivially visible can imply parally visible (subject to shortening) or invisible segment (addional tesng needed) k 4 = T k =k 4 =0 B k = O k=00 k=000 k=00 k=000 k=0000 k= k=00 k=000 k=00 k = L k =k =0 R k = 48

9 In Step, k ^k = 0, but k 0 or k 0 (or both) Otherwise the segment would be fully visible (Step ) Suppose that k 0, which means that P is outside If not, switch P and P : ß à ; ß à ; k ß à k We need to bring P on the edge of the window Actually, replace P by the intersecon point of the segment P P and the corresponding window edge If k =, find intersecon with the lea edge L If k =, find intersecon with the the right edge R If k =, find intersecon with the booom edge B If k 4 = find intersecon with the the top edge T Go to Step and repeat unl P en P are found Search for intersecons P (,) T Intersecon with L := + (L- ) * ( - ) / ( - ) P (,) B := L L R Intersecon with R: same as above with R instead of L Intersecon with B := + (B- ) * ( - ) / ( - ) := B Intersecon with T: same as above with T instead of B Denominators cannot be equal to 0 (no division by 0) In the first case (bringing on L), this would mean that the segment is vercal, and too much to the lea à already eliminated P (, ) P T (, ) B O L R P (, ) P (, ) T B P (, ) P (, ) O L R P (, ) P (, ) 5 5 Polygon clipping Polygon clipping Find the parts of polygons inside the clip window Polygon clipping = scissoring according to clip window Must deal with many different cases Clipping a single polygon can result in mulple polygons 5 54

10 Sutherland- Hodgman Clipping Algorithm Clipping to one window boundary at a me Sutherland- Hodgman Clipping Algorithm Clipping to one window boundary at a me Sutherland- Hodgman Clipping Algorithm Clipping to one window boundary at a me Sutherland- Hodgman Clipping Algorithm Clipping to one window boundary at a me Polygon clipping Clipping to one window boundary at a me P 5 P P P 59 60

11 P 5 P P 5 P P P P P 6 6 P 5 P P 5 P P P P P P 6 64 P 5 P P 5 P P P P P P P 65 66

12 Outside window Inside window Outside window Inside window P 5 P P P P P P P P P Inside test Outside the clip rectangle Inside the clip rectangle Summary Scan conversion of lines: midpoint line algorithm P E Scan conversion of circles and ellipses: use symmetries P P N i (P - P E ) > 0 (outside) Clipping in D: Cohen- Sutherland algorithm based on assigning 4- bit code words to the end points of the line P N i (P - P E ) = 0 (on edge) Clipping polygons inside test N i N i (P - P E ) < 0 (inside) Define edge s outward normal N i For a point P i test the sign of the dot product N i (P i - P E ) 69 70

Graphics (Output) Primitives. Chapters 3 & 4

Graphics (Output) Primitives. Chapters 3 & 4 Graphics (Output) Primitives Chapters 3 & 4 Graphic Output and Input Pipeline Scan conversion converts primitives such as lines, circles, etc. into pixel values geometric description a finite scene area

More information

Chapter 8: Implementation- Clipping and Rasterization

Chapter 8: Implementation- Clipping and Rasterization Chapter 8: Implementation- Clipping and Rasterization Clipping Fundamentals Cohen-Sutherland Parametric Polygons Circles and Curves Text Basic Concepts: The purpose of clipping is to remove objects or

More information

From Ver(ces to Fragments: Rasteriza(on

From Ver(ces to Fragments: Rasteriza(on From Ver(ces to Fragments: Rasteriza(on From Ver(ces to Fragments 3D vertices vertex shader rasterizer fragment shader final pixels 2D screen fragments l determine fragments to be covered l interpolate

More information

Computer Graphics. - Rasterization - Philipp Slusallek

Computer Graphics. - Rasterization - Philipp Slusallek Computer Graphics - Rasterization - Philipp Slusallek Rasterization Definition Given some geometry (point, 2D line, circle, triangle, polygon, ), specify which pixels of a raster display each primitive

More information

Rendering. A simple X program to illustrate rendering

Rendering. A simple X program to illustrate rendering Rendering A simple X program to illustrate rendering The programs in this directory provide a simple x based application for us to develop some graphics routines. Please notice the following: All points

More information

Graphics System. Processor. Output Display. Input Devices. Frame Buffer. Memory. Array of pixels. Resolution: # of pixels Depth: # of bits/pixel

Graphics System. Processor. Output Display. Input Devices. Frame Buffer. Memory. Array of pixels. Resolution: # of pixels Depth: # of bits/pixel Graphics System Input Devices Processor Memory Frame Buffer Output Display Array of pixels Resolution: # of pixels Depth: # of bits/pixel Input Devices Physical Devices: Keyboard, Mouse, Tablet, etc. Logical

More information

CPSC / Scan Conversion

CPSC / Scan Conversion CPSC 599.64 / 601.64 Computer Screens: Raster Displays pixel rasters (usually) square pixels in rectangular raster evenly cover the image problem no such things such as lines, circles, etc. scan conversion

More information

Line Drawing. Foundations of Computer Graphics Torsten Möller

Line Drawing. Foundations of Computer Graphics Torsten Möller Line Drawing Foundations of Computer Graphics Torsten Möller Rendering Pipeline Hardware Modelling Transform Visibility Illumination + Shading Perception, Interaction Color Texture/ Realism Reading Angel

More information

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

Line Drawing. Introduction to Computer Graphics Torsten Möller / Mike Phillips. Machiraju/Zhang/Möller Line Drawing Introduction to Computer Graphics Torsten Möller / Mike Phillips Rendering Pipeline Hardware Modelling Transform Visibility Illumination + Shading Perception, Color Interaction Texture/ Realism

More information

Scan Converting Lines

Scan Converting Lines Scan Conversion 1 Scan Converting Lines Line Drawing Draw a line on a raster screen between two points What s wrong with the statement of the problem? it doesn t say anything about which points are allowed

More information

COMP371 COMPUTER GRAPHICS

COMP371 COMPUTER GRAPHICS COMP371 COMPUTER GRAPHICS LECTURE 14 RASTERIZATION 1 Lecture Overview Review of last class Line Scan conversion Polygon Scan conversion Antialiasing 2 Rasterization The raster display is a matrix of picture

More information

Tópicos de Computação Gráfica Topics in Computer Graphics 10509: Doutoramento em Engenharia Informática. Chap. 2 Rasterization.

Tópicos de Computação Gráfica Topics in Computer Graphics 10509: Doutoramento em Engenharia Informática. Chap. 2 Rasterization. Tópicos de Computação Gráfica Topics in Computer Graphics 10509: Doutoramento em Engenharia Informática Chap. 2 Rasterization Rasterization Outline : Raster display technology. Basic concepts: pixel, resolution,

More information

Rasterization: Geometric Primitives

Rasterization: Geometric Primitives Rasterization: Geometric Primitives Outline Rasterizing lines Rasterizing polygons 1 Rasterization: What is it? How to go from real numbers of geometric primitives vertices to integer coordinates of pixels

More information

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

From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored. From Vertices to Fragments: Rasterization Reading Assignment: Chapter 7 Frame Buffer Special memory where pixel colors are stored. System Bus CPU Main Memory Graphics Card -- Graphics Processing Unit (GPU)

More information

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

Announcements. Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class. Computer Graphics Announcements Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class 1 Scan Conversion Overview of Rendering Scan Conversion Drawing Lines Drawing Polygons

More information

Topics. From vertices to fragments

Topics. From vertices to fragments Topics From vertices to fragments From Vertices to Fragments Assign a color to every pixel Pass every object through the system Required tasks: Modeling Geometric processing Rasterization Fragment processing

More information

Einführung in Visual Computing

Einführung in Visual Computing Einführung in Visual Computing 186.822 Rasterization Werner Purgathofer Rasterization in the Rendering Pipeline scene objects in object space transformed vertices in clip space scene in normalized device

More information

Scan Conversion. Drawing Lines Drawing Circles

Scan Conversion. Drawing Lines Drawing Circles Scan Conversion Drawing Lines Drawing Circles 1 How to Draw This? 2 Start From Simple How to draw a line: y(x) = mx + b? 3 Scan Conversion, a.k.a. Rasterization Ideal Picture Raster Representation Scan

More information

CS488 2D Graphics. Luc RENAMBOT

CS488 2D Graphics. Luc RENAMBOT CS488 2D Graphics Luc RENAMBOT 1 Topics Last time, hardware and frame buffer Now, how lines and polygons are drawn in the frame buffer. Then, how 2D and 3D models drawing into the frame buffer Then, more

More information

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines COMP30019 Graphics and Interaction Scan Converting Polygons and Lines Department of Computer Science and Software Engineering The Lecture outline Introduction Scan conversion Scan-line algorithm Edge coherence

More information

Rendering. A simple X program to illustrate rendering

Rendering. A simple X program to illustrate rendering Rendering A simple X program to illustrate rendering The programs in this directory provide a simple x based application for us to develop some graphics routines. Please notice the following: All points

More information

Topic #1: Rasterization (Scan Conversion)

Topic #1: Rasterization (Scan Conversion) Topic #1: Rasterization (Scan Conversion) We will generally model objects with geometric primitives points, lines, and polygons For display, we need to convert them to pixels for points it s obvious but

More information

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

Computer Graphics (CS 543) Lecture 10: Rasterization and Antialiasing Computer Graphics (CS 543) Lecture 10: Rasterization and Antialiasing Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Recall: Rasterization Rasterization (scan conversion)

More information

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

OpenGL Graphics System. 2D Graphics Primitives. Drawing 2D Graphics Primitives. 2D Graphics Primitives. Mathematical 2D Primitives. D Graphics Primitives Eye sees Displays - CRT/LCD Frame buffer - Addressable pixel array (D) Graphics processor s main function is to map application model (D) by projection on to D primitives: points,

More information

1 Introduction to Graphics

1 Introduction to Graphics 1 1.1 Raster Displays The screen is represented by a 2D array of locations called pixels. Zooming in on an image made up of pixels The convention in these notes will follow that of OpenGL, placing the

More information

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU FROM VERTICES TO FRAGMENTS Lecture 5 Comp3080 Computer Graphics HKBU OBJECTIVES Introduce basic implementation strategies Clipping Scan conversion OCTOBER 9, 2011 2 OVERVIEW At end of the geometric pipeline,

More information

Chapter 3. Sukhwinder Singh

Chapter 3. Sukhwinder Singh Chapter 3 Sukhwinder Singh PIXEL ADDRESSING AND OBJECT GEOMETRY Object descriptions are given in a world reference frame, chosen to suit a particular application, and input world coordinates are ultimately

More information

Scan Conversion. Lines and Circles

Scan Conversion. Lines and Circles Scan Conversion Lines and Circles (Chapter 3 in Foley & Van Dam) 2D Line Implicit representation: αx + βy + γ = 0 Explicit representation: y y = mx+ B m= x Parametric representation: x P= y P = t y P +

More information

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

Renderer Implementation: Basics and Clipping. Overview. Preliminaries. David Carr Virtual Environments, Fundamentals Spring 2005 INSTITUTIONEN FÖR SYSTEMTEKNIK LULEÅ TEKNISKA UNIVERSITET Renderer Implementation: Basics and Clipping David Carr Virtual Environments, Fundamentals Spring 2005 Feb-28-05 SMM009, Basics and Clipping 1

More information

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

Rasterization, or What is glbegin(gl_lines) really doing? Rasterization, or What is glbegin(gl_lines) really doing? Course web page: http://goo.gl/eb3aa February 23, 2012 Lecture 4 Outline Rasterizing lines DDA/parametric algorithm Midpoint/Bresenham s algorithm

More information

Pipeline implementation II

Pipeline implementation II Pipeline implementation II Overview Line Drawing Algorithms DDA Bresenham Filling polygons Antialiasing Rasterization Rasterization (scan conversion) Determine which pixels that are inside primitive specified

More information

Computer Graphics 7 - Rasterisation

Computer Graphics 7 - Rasterisation Computer Graphics 7 - Rasterisation Tom Thorne Slides courtesy of Taku Komura www.inf.ed.ac.uk/teaching/courses/cg Overview Line rasterisation Polygon rasterisation Mean value coordinates Decomposing polygons

More information

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

Incremental Form. Idea. More efficient if we look at d k, the value of the decision variable at x = k Idea 1 m 0 candidates last pixel Note that line could have passed through any part of this pixel Decision variable: d = x(a-b) d is an integer d < 0 use upper pixel d > 0 use lower pixel Incremental Form

More information

Department of Computer Sciences Graphics Fall 2003 (Lecture 2) Pixels

Department of Computer Sciences Graphics Fall 2003 (Lecture 2) Pixels Pixels Pixel: Intensity or color sample. Raster Image: Rectangular grid of pixels. Rasterization: Conversion of a primitive s geometric representation into A set of pixels. An intensity or color for each

More information

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1 graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1 graphics pipeline sequence of operations to generate an image using object-order processing primitives processed one-at-a-time

More information

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1 graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1 graphics pipeline sequence of operations to generate an image using object-order processing primitives processed one-at-a-time

More information

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

CS602 Midterm Subjective Solved with Reference By WELL WISHER (Aqua Leo) CS602 Midterm Subjective Solved with Reference By WELL WISHER (Aqua Leo) www.vucybarien.com Question No: 1 What are the two focusing methods in CRT? Explain briefly. Page no : 26 1. Electrostatic focusing

More information

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

Rasterization. Rasterization (scan conversion) Digital Differential Analyzer (DDA) Rasterizing a line. Digital Differential Analyzer (DDA) CSCI 420 Computer Graphics Lecture 14 Rasterization Jernej Barbic University of Southern California Scan Conversion Antialiasing [Angel Ch. 6] Rasterization (scan conversion) Final step in pipeline: rasterization

More information

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

Implementation III. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico Implementation III Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico Objectives Survey Line Drawing Algorithms - DDA - Bresenham 2 Rasterization

More information

(Refer Slide Time: 00:03:51)

(Refer Slide Time: 00:03:51) Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 17 Scan Converting Lines, Circles and Ellipses Hello and welcome everybody

More information

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

Polygon Filling. Can write frame buffer one word at time rather than one bit. 2/3/2000 CS 4/57101 Lecture 6 1 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

More information

CS 543: Computer Graphics. Rasterization

CS 543: Computer Graphics. Rasterization CS 543: Computer Graphics Rasterization Robert W. Lindeman Associate Professor Interactive Media & Game Development Department of Computer Science Worcester Polytechnic Institute gogo@wpi.edu (with lots

More information

CS Rasterization. Junqiao Zhao 赵君峤

CS Rasterization. Junqiao Zhao 赵君峤 CS10101001 Rasterization Junqiao Zhao 赵君峤 Department of Computer Science and Technology College of Electronics and Information Engineering Tongji University Vector Graphics Algebraic equations describe

More information

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

CS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines. Emmanuel Agu CS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines Emmanuel Agu 2D Graphics Pipeline Clipping Object World Coordinates Applying world window Object subset window to viewport mapping

More information

Realtime 3D Computer Graphics Virtual Reality

Realtime 3D Computer Graphics Virtual Reality Realtime 3D Computer Graphics Virtual Reality From Vertices to Fragments Overview Overall goal recapitulation: Input: World description, e.g., set of vertices and states for objects, attributes, camera,

More information

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

Raster Displays and Scan Conversion. Computer Graphics, CSCD18 Fall 2008 Instructor: Leonid Sigal Raster Displays and Scan Conversion Computer Graphics, CSCD18 Fall 28 Instructor: Leonid Sigal Rater Displays Screen is represented by 2D array of locations called piels y Rater Displays Screen is represented

More information

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

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 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 the viewport of the current application window. A pixel

More information

UNIT 2 GRAPHIC PRIMITIVES

UNIT 2 GRAPHIC PRIMITIVES UNIT 2 GRAPHIC PRIMITIVES Structure Page Nos. 2.1 Introduction 46 2.2 Objectives 46 2.3 Points and Lines 46 2.4 Line Generation Algorithms 48 2.4.1 DDA Algorithm 49 2.4.2 Bresenhams Line Generation Algorithm

More information

UNIT -8 IMPLEMENTATION

UNIT -8 IMPLEMENTATION UNIT -8 IMPLEMENTATION 1. Discuss the Bresenham s rasterization algorithm. How is it advantageous when compared to other existing methods? Describe. (Jun2012) 10M Ans: Consider drawing a line on a raster

More information

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

Computer Graphics : Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling Computer Graphics : Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling Downloaded from :www.comp.dit.ie/bmacnamee/materials/graphics/006- Contents In today s lecture we ll have a loo at:

More information

Line Drawing Week 6, Lecture 9

Line Drawing Week 6, Lecture 9 CS 536 Computer Graphics Line Drawing Week 6, Lecture 9 David Breen, William Regli and axim Peysakhov Department of Computer Science Drexel University Outline Line drawing Digital differential analyzer

More information

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

Scan Conversion. CMP 477 Computer Graphics S. A. Arekete Scan Conversion CMP 477 Computer Graphics S. A. Areete What is Scan-Conversion? 2D or 3D objects in real world space are made up of graphic primitives such as points, lines, circles and filled polygons.

More information

Chapter - 2: Geometry and Line Generations

Chapter - 2: Geometry and Line Generations Chapter - 2: Geometry and Line Generations In Computer graphics, various application ranges in different areas like entertainment to scientific image processing. In defining this all application mathematics

More information

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

Fall CSCI 420: Computer Graphics. 7.1 Rasterization. Hao Li. Fall 2015 CSCI 420: Computer Graphics 7.1 Rasterization Hao Li http://cs420.hao-li.com 1 Rendering Pipeline 2 Outline Scan Conversion for Lines Scan Conversion for Polygons Antialiasing 3 Rasterization

More information

From Vertices To Fragments-1

From Vertices To Fragments-1 From Vertices To Fragments-1 1 Objectives Clipping Line-segment clipping polygon clipping 2 Overview At end of the geometric pipeline, vertices have been assembled into primitives Must clip out primitives

More information

Overview of Computer Graphics

Overview of Computer Graphics Application of Computer Graphics UNIT- 1 Overview of Computer Graphics Computer-Aided Design for engineering and architectural systems etc. Objects maybe displayed in a wireframe outline form. Multi-window

More information

Rasterization. COMP 575/770 Spring 2013

Rasterization. COMP 575/770 Spring 2013 Rasterization COMP 575/770 Spring 2013 The Rasterization Pipeline you are here APPLICATION COMMAND STREAM 3D transformations; shading VERTEX PROCESSING TRANSFORMED GEOMETRY conversion of primitives to

More information

Computer Graphics Lecture Notes

Computer Graphics Lecture Notes Computer Graphics Lecture Notes UNIT- Overview of Computer Graphics. Application of Computer Graphics Computer-Aided Design for engineering and architectural systems etc. Objects maybe displayed in a wireframe

More information

CS 130. Scan Conversion. Raster Graphics

CS 130. Scan Conversion. Raster Graphics CS 130 Scan Conversion Raster Graphics 2 1 Image Formation Computer graphics forms images, generally two dimensional, using processes analogous to physical imaging systems like: - Cameras - Human visual

More information

Computer Graphics D Graphics Algorithms

Computer Graphics D Graphics Algorithms Computer Graphics 2015 2. 2D Graphics Algorithms Hongxin Zhang State Key Lab of CAD&CG, Zhejiang University 2015-09-21 Screen - Linear Structure Nikon D40 Sensors 3 RGBW Camera Sensor RGBW Camera Sensor

More information

CSCI 4620/8626. Coordinate Reference Frames

CSCI 4620/8626. Coordinate Reference Frames CSCI 4620/8626 Computer Graphics Graphics Output Primitives Last update: 2014-02-03 Coordinate Reference Frames To describe a picture, the world-coordinate reference frame (2D or 3D) must be selected.

More information

SE Mock Online Test 1-CG

SE Mock Online Test 1-CG SE Mock Online Test 1-CG 1. Email address * 2. 1. For gentle slope line, slope m is -1

More information

The Traditional Graphics Pipeline

The Traditional Graphics Pipeline Last Time? The Traditional Graphics Pipeline Participating Media Measuring BRDFs 3D Digitizing & Scattering BSSRDFs Monte Carlo Simulation Dipole Approximation Today Ray Casting / Tracing Advantages? Ray

More information

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

CSCI 420 Computer Graphics Lecture 14. Rasterization. Scan Conversion Antialiasing [Angel Ch. 6] Jernej Barbic University of Southern California CSCI 420 Computer Graphics Lecture 14 Rasterization Scan Conversion Antialiasing [Angel Ch. 6] Jernej Barbic University of Southern California 1 Rasterization (scan conversion) Final step in pipeline:

More information

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14 Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14 Scan Converting Lines, Circles and Ellipses Hello everybody, welcome again

More information

EF432. Introduction to spagetti and meatballs

EF432. Introduction to spagetti and meatballs EF432 Introduction to spagetti and meatballs CSC 418/2504: Computer Graphics Course web site (includes course information sheet): http://www.dgp.toronto.edu/~karan/courses/418/fall2015 Instructor: Karan

More information

CS 130 Exam I. Fall 2015

CS 130 Exam I. Fall 2015 S 3 Exam I Fall 25 Name Student ID Signature You may not ask any questions during the test. If you believe that there is something wrong with a question, write down what you think the question is trying

More information

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

2D Image Synthesis. 2D image synthesis. Raster graphics systems. Modeling transformation. Vectorization. u x u y 0. o x o y 1 General scheme of a 2D CG application 2D Image Synthesis Balázs Csébfalvi modeling image synthesis Virtual world model world defined in a 2D plane Department of Control Engineering and Information Technology

More information

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

CS452/552; EE465/505. Clipping & Scan Conversion CS452/552; EE465/505 Clipping & Scan Conversion 3-31 15 Outline! From Geometry to Pixels: Overview Clipping (continued) Scan conversion Read: Angel, Chapter 8, 8.1-8.9 Project#1 due: this week Lab4 due:

More information

The Traditional Graphics Pipeline

The Traditional Graphics Pipeline Final Projects Proposals due Thursday 4/8 Proposed project summary At least 3 related papers (read & summarized) Description of series of test cases Timeline & initial task assignment The Traditional Graphics

More information

(Refer Slide Time: 00:02:00)

(Refer Slide Time: 00:02:00) Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 18 Polyfill - Scan Conversion of a Polygon Today we will discuss the concepts

More information

Computer Graphics D Graphics Algorithms

Computer Graphics D Graphics Algorithms ! Computer Graphics 2014! 2. 2D Graphics Algorithms Hongxin Zhang State Key Lab of CAD&CG, Zhejiang University 2014-09-26! Screen Nikon D40 Sensors 3 Rasterization - The task of displaying a world modeled

More information

Efficient Plotting Algorithm

Efficient Plotting Algorithm Efficient Plotting Algorithm Sushant Ipte 1, Riddhi Agarwal 1, Murtuza Barodawala 1, Ravindra Gupta 1, Prof. Shiburaj Pappu 1 Computer Department, Rizvi College of Engineering, Mumbai, Maharashtra, India

More information

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

CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE DRAWING PRIMITIVES: LEGACY VS. NEW Legacy: specify primitive in glbegin() glbegin(gl_points); glvertex3f(1,5,0);

More information

Raster Scan Displays. Framebuffer (Black and White)

Raster Scan Displays. Framebuffer (Black and White) Raster Scan Displays Beam of electrons deflected onto a phosphor coated screen Phosphors emit light when excited by the electrons Phosphor brightness decays -- need to refresh the display Phosphors make

More information

The Traditional Graphics Pipeline

The Traditional Graphics Pipeline Last Time? The Traditional Graphics Pipeline Reading for Today A Practical Model for Subsurface Light Transport, Jensen, Marschner, Levoy, & Hanrahan, SIGGRAPH 2001 Participating Media Measuring BRDFs

More information

Shading Techniques Denbigh Starkey

Shading Techniques Denbigh Starkey Shading Techniques Denbigh Starkey 1. Summary of shading techniques 2 2. Lambert (flat) shading 3 3. Smooth shading and vertex normals 4 4. Gouraud shading 6 5. Phong shading 8 6. Why do Gouraud and Phong

More information

Institutionen för systemteknik

Institutionen för systemteknik Code: Day: Lokal: M7002E 19 March E1026 Institutionen för systemteknik Examination in: M7002E, Computer Graphics and Virtual Environments Number of sections: 7 Max. score: 100 (normally 60 is required

More information

CSCI 4620/8626. Computer Graphics Clipping Algorithms (Chapter 8-5 )

CSCI 4620/8626. Computer Graphics Clipping Algorithms (Chapter 8-5 ) CSCI 4620/8626 Computer Graphics Clipping Algorithms (Chapter 8-5 ) Last update: 2016-03-15 Clipping Algorithms A clipping algorithm is any procedure that eliminates those portions of a picture outside

More information

MET71 COMPUTER AIDED DESIGN

MET71 COMPUTER AIDED DESIGN UNIT - II BRESENHAM S ALGORITHM BRESENHAM S LINE ALGORITHM Bresenham s algorithm enables the selection of optimum raster locations to represent a straight line. In this algorithm either pixels along X

More information

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

Rendering. Basic Math Review. Rasterizing Lines and Polygons Hidden Surface Remove Multi-pass Rendering with Accumulation Buffers. Rendering Rasterizing Lines and Polygons Hidden Surface Remove Multi-pass Rendering with Accumulation Buffers Basic Math Review Slope-Intercept Formula For Lines Given a third point on the line: P = (X,Y)

More information

CS602 MCQ,s for midterm paper with reference solved by Shahid

CS602 MCQ,s for midterm paper with reference solved by Shahid #1 Rotating a point requires The coordinates for the point The rotation angles Both of above Page No 175 None of above #2 In Trimetric the direction of projection makes unequal angle with the three principal

More information

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Clipping. Concepts, Algorithms for line clipping. 1 of 16. Andries van Dam. Clipping - 10/12/17

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Clipping. Concepts, Algorithms for line clipping. 1 of 16. Andries van Dam. Clipping - 10/12/17 Clipping Concepts, Algorithms for line clipping 1 of 16 Line Clipping in 2D Clipping endpoints If x min x x max and y min y y max, the point is inside the clip rectangle. Endpoint analysis for lines: if

More information

Display Technologies: CRTs Raster Displays

Display Technologies: CRTs Raster Displays Rasterization Display Technologies: CRTs Raster Displays Raster: A rectangular array of points or dots Pixel: One dot or picture element of the raster Scanline: A row of pixels Rasterize: find the set

More information

RASTERIZING POLYGONS IN IMAGE SPACE

RASTERIZING POLYGONS IN IMAGE SPACE On-Line Computer Graphics Notes RASTERIZING POLYGONS IN IMAGE SPACE Kenneth I. Joy Visualization and Graphics Research Group Department of Computer Science University of California, Davis A fundamental

More information

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

Output Primitives. Dr. S.M. Malaek. Assistant: M. Younesi Output Primitives Dr. S.M. Malaek Assistant: M. Younesi Output Primitives Output Primitives: Basic geometric structures (points, straight line segment, circles and other conic sections, quadric surfaces,

More information

Graphics Output Primitives

Graphics Output Primitives Important Graphics Output Primitives Graphics Output Primitives in 2D polgons, circles, ellipses & other curves piel arra operations in 3D triangles & other polgons Werner Purgathofer / Computergraphik

More information

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

2D Graphics Primitives II. Additional issues in scan converting lines. 1)Endpoint order. Want algorithms to draw the same pixels for each line walters@buffalo.edu CSE 480/580 Lecture 8 Slide 1 2D Graphics Primitives II Additional issues in scan converting lines 1)Endpoint order Want algorithms to draw the same pixels for each line How handle?

More information

Computer Graphics - Week 6

Computer Graphics - Week 6 Computer Graphics - Week 6 Bengt-Olaf Schneider IBM T.J. Watson Research Center Questions about Last Week? Questions about Assignment? Comments about submission Deadline is Friday, 2/26 at 5:30 pm Standard

More information

Output Primitives Lecture: 3. Lecture 3. Output Primitives. Assuming we have a raster display, a picture is completely specified by:

Output Primitives Lecture: 3. Lecture 3. Output Primitives. Assuming we have a raster display, a picture is completely specified by: Lecture 3 Output Primitives Assuming we have a raster display, a picture is completely specified by: - A set of intensities for the pixel positions in the display. - A set of complex objects, such as trees

More information

From 3D World to 2D Screen. Hendrik Speleers

From 3D World to 2D Screen. Hendrik Speleers Hendrik Speleers Overview Synthetic camera Rendering pipeline World window versus viewport Clipping Cohen-Sutherland algorithm Rasterizing Bresenham algorithm Three different actors in a scene Objects:

More information

Computer Graphics. The Two-Dimensional Viewing. Somsak Walairacht, Computer Engineering, KMITL

Computer Graphics. The Two-Dimensional Viewing. Somsak Walairacht, Computer Engineering, KMITL Computer Graphics Chapter 6 The Two-Dimensional Viewing Somsak Walairacht, Computer Engineering, KMITL Outline The Two-Dimensional Viewing Pipeline The Clipping Window Normalization and Viewport Transformations

More information

Output Primitives Lecture: 4. Lecture 4

Output Primitives Lecture: 4. Lecture 4 Lecture 4 Circle Generating Algorithms Since the circle is a frequently used component in pictures and graphs, a procedure for generating either full circles or circular arcs is included in most graphics

More information

CS 130 Final. Fall 2015

CS 130 Final. Fall 2015 CS 130 Final Fall 2015 Name Student ID Signature You may not ask any questions during the test. If you believe that there is something wrong with a question, write down what you think the question is trying

More information

Unit 2 Output Primitives and their Attributes

Unit 2 Output Primitives and their Attributes Unit 2 Output Primitives and their Attributes Shapes and colors of the objects can be described internally with pixel arrays or with sets of basic geometric structures, such as straight line segments and

More information

MODULE - 4. e-pg Pathshala

MODULE - 4. e-pg Pathshala e-pg Pathshala MODULE - 4 Subject : Computer Science Paper: Computer Graphics and Visualization Module: Midpoint Circle Drawing Procedure Module No: CS/CGV/4 Quadrant 1 e-text Before going into the Midpoint

More information

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Computer Graphics

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Computer Graphics r About the Tutorial To display a picture of any size on a computer screen is a difficult process. Computer graphics are used to simplify this process. Various algorithms and techniques are used to generate

More information

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

0. Introduction: What is Computer Graphics? 1. Basics of scan conversion (line drawing) 2. Representing 2D curves CSC 418/2504: Computer Graphics Course web site (includes course information sheet): http://www.dgp.toronto.edu/~elf Instructor: Eugene Fiume Office: BA 5266 Phone: 416 978 5472 (not a reliable way) Email:

More information

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

Write C++/Java program to draw line using DDA and Bresenham s algorithm. Inherit pixel class and Use function overloading. Group A Assignment No A1. Write C++/Java program to draw line using DDA and Bresenham s algorithm. Inherit pixel class and Use function overloading. Aim: To draw line using DDA and Bresenham s algorithm

More information

Computer Graphics. - Clipping - Philipp Slusallek & Stefan Lemme

Computer Graphics. - Clipping - Philipp Slusallek & Stefan Lemme Computer Graphics - Clipping - Philipp Slusallek & Stefan Lemme Clipping Motivation Projected primitive might fall (partially) outside of the visible display window E.g. if standing inside a building Eliminate

More information