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

Size: px
Start display at page:

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

Transcription

1 INSTITUTIONEN FÖR SYSTEMTEKNIK LULEÅ TEKNISKA UNIVERSITET Renderer Implementation: Basics and Clipping David Carr Virtual Environments, Fundamentals Spring 2005 Feb SMM009, Basics and Clipping 1 L Overview Preliminaries Clipping - Line + Cohen-Sutherland + Liang-Barsky + Cohen-Sutherland in 3D - Polygon, Sutherland-Hodgman Hidden surface removal - Back-face removal - Depth sorting - Painter s algorithm - Z-buffer algorithm - Octree methods Scan conversion - Digital difference analyzers - Bresenham s algorithm - Circles - Flood fill Antialiasing Feb SMM009, Basics and Clipping 2 L INSTITUTIONEN FÖR SYSTEMTEKNIK LULEÅ TEKNISKA UNIVERSITET Preliminaries Feb SMM009, Basics and Clipping 3 L 1

2 Two Approaches Object oriented - Forward object by object to frame buffer - Follows pipeline model - Main drawback, cannot support global effects Image oriented - From pixel to object - Supports global effects - Main drawback, inverse functions are problematic Feb SMM009, Basics and Clipping 4 L Four Major Tasks Modeling application program Geometric processing already studied Rasterization next two lectures Display automatic Modeling Feb Geometric Processing Rasterization SMM009, Basics and Clipping Display 5 L 6 L Coordinate Transformations Object Eye/Camera Clip Normalized Device Coordinates Display Feb SMM009, Basics and Clipping 2

3 From NDC Transformation to Window Coordinates x v = x v min + ( x " x min ) x v max " x v min x max " x min y v = y v min + ( y " y min ) y v max " y v min y max " y min If depth is to be preserved add z v = z v min + ( z " z min ) z " z v max v min z max " z min For OpenGL, standard clipping volume x v = x v min + ( x +1) x v max " x v min 2 Feb SMM009, Basics and Clipping 7 L INSTITUTIONEN FÖR SYSTEMTEKNIK LULEÅ TEKNISKA UNIVERSITET Clipping Feb SMM009, Basics and Clipping 8 L Four general cases of a line segment - All inside AB - All outside CD - Partially in, one endpoint EF - Partially in, no endpoints GH Line Clipping in 2D Feb SMM009, Basics and Clipping 9 L 3

4 Cohen-Sutherland Clipping For each end point (p 1, p 2 ) - Assign codes (c 1, c 2 ) according to the figure - If (c 1 c 2 ) == 0, all in draw line - Else if (c 1 & c 2 ) 0, all out discard line - Else divide line along one clipping window edge + Based on (c 1 & c 2 ) + Recursively repeat x = x min x = x max y = y max y = y min Feb SMM009, Basics and Clipping 10 L Cohen-Sutherland Line Division In general, which edge first doesn t matter when a line crosses more than one. Against a vertical edge let x = x max or x = x min ( ) - Then, y new = y 1 + y " y 2 1 ( ( x 2 " x 1 ) x " x 1), x 1 # x 2 - Sort points so that x 1 is smallest (largest) when clipping from the left (right) - And, the new line segments are [(x 1,y 1 ) - (x,y new )] and [(x±1,y new ) - [(x 1,y 1 )] Similarly, for horizontal edges just exchange x and y Feb SMM009, Basics and Clipping 11 L Cohen-Sutherland Example p 1 p y = y max y = y min x = x min x = x max Feb SMM009, Basics and Clipping 12 L 4

5 Cohen-Sutherland in Practice Advantages - Simple operations - Efficient + Especially when most segments don t cross the clipping window - Extendable to 3D Disadvantages - Recursive division of lines + Intersection computations early - Vertical and horizontal lines are a singularity when dividing lines - Edges require special handling with floating point coordinates Feb SMM009, Basics and Clipping 13 L More Efficient Clipping Idea is to delay intersection calculations Base on parametric form of a line - For a line segment [p 1, p 2 ], the segment between them is given by: - x = x 1 + α(x 2 - x 1 ) - y = y 1 + α(y 2 - y 1 ) 0 α 1 Feb SMM009, Basics and Clipping 14 L Liang-Barsky Clipping If the clipping window boundaries are: - x wmin, x wmax, y wmin, and y wmax Then, the clipping conditions can be expressed as: - x wmin x 1 + α(x 2 - x 1 ) x wmax - y wmin y 1 + α(y 2 - y 1 ) y wmax Which gives the following four inequalities αp k q k k = p 1 = (x 2 - x 1 ) q 1 = x 1 - x wmin + p 2 = (x 2 - x 1 ) q 2 = x wmax - x 1 + p 3 = (y 2 - y 1 ) q 3 = y 1 - y wmin + p 4 = (y 2 - y 1 ) q 4 = y wmax - y 1 Want to keep α 1, α 2 that represent the intersection of the extensions of the line with the clipping window Feb SMM009, Basics and Clipping 15 L 5

6 Liang-Barsky Tests If p k = 0 - The line is parallel to the edge corresponding to k (p k = 0) - And, q k < 0 + Completely outside of the clipping window - And, q k 0 + Inside the corresponding border, must considered If p k < 0 - Infinite extension proceeds outside to inside - r = q k / p k, if r > α 2, then line is outside discard - α 1 = max(r,α 1 ) If p k > 0 - Infinite extension proceeds inside to outside - r = q k / p k, if r < α 1, then line is outside discard - α 2 = min(r,α 2 ) Feb SMM009, Basics and Clipping 16 L Liang-Barsky Example P 2 y = y max p 1 = (x 2 - x 1 ), q 1 = x 1 - x wmin p 2 = (x 2 - x 1 ), q 2 = x wmax - x 1 y = y min P 1 x = x min p 3 = (y 2 - y 1 ), q 3 = y 1 - y wmin p 4 = (y 2 - y 1 ), q 4 = y wmax - y 1 α 1 = 0, α 2 = 1 x = x max Feb SMM009, Basics and Clipping 17 L Liang-Barsky versus Cohen-Sutherland Liang-Barsky generally avoids computing multiple intersection points Liang-Barsky only uses one divide per test Cohen-Sutherland can repeatedly subdivide a line that is outside of the clipping region Feb SMM009, Basics and Clipping 18 L 6

7 Extending Cohen-Sutherland to 3D Add codes for in-front-of and behind These compute with respect to the z values Proceed as before but now with a 6-bit code Feb SMM009, Basics and Clipping 19 L Pipeline Clipping The above algorithms consider the clipping region as a box However, we could consider it to be four infinite lines giving four half-planes Thus, we could test each in succession Left Clipper Right Clipper Bottom Clipper Top Clipper Feb SMM009, Basics and Clipping 20 L Polygon Clipping Clipping so far has only considered line segments or unfilled polygons However, we model with filled polygons Remember, convex and non-convex polygons - Clipping of non-convex polygons is difficult - One polygon can become many - Most packages require convex polygons Feb SMM009, Basics and Clipping 21 L 7

8 Sutherland-Hodgman Polygon Clipping Pipeline-based algorithm Works on convex polygons - Can be extended to non-convex - Or, polygons can be tessellated first Idea - Walk around the polygon vertices in order (counterclockwise) - Pipeline clip against each half-plane Left Clipper Right Clipper Bottom Clipper - Generate new vertices based on the boundary lines Top Clipper Feb SMM009, Basics and Clipping 22 L Sutherland-Hodgman, Four Cases v 2 v 1 v 1 ' v 2 out in Output: v 1 ',v 2 v 1 in in Output: v 2 v 1 ' v 2 v 1 v 1 in out v 2 out out Output: none ' Output: v 1 Feb SMM009, Basics and Clipping 23 L Sutherland-Hodgman, Example v 3 v 4 & v 4 v 5 : in " in v 5 output : v 4 & v 5 v 5 v 1 : in " out v " output : v 1 # 5 v 4 v 1 {v 1,v 2,v 3,v 4,v 5 } v 1 v 2 : out " in output : v 1 #,v 2 " v 1 v 2 v 3 : in " in v output : v 3 Feb SMM009, Basics and Clipping 24 L v 3 8

9 v 5 v 5 " : in # in output : v 5 " Sutherland-Hodgman, Example v 4 v 5 : out " in output : v # 4,v 5 " v 5 v 5 " v 4 v 4 v 3 v 4 : out " out output : none v 5 " v 1 " : in # in output : v 1 " { v 1 ",v 2,v 3,v 4,v 5, v 5 " } v 1 " v 2 : in # in output : v 2 " v 1 v 3 v 2 v 3 : in " out v v 2 Feb SMM009, Basics and Clipping 25 L " v 2 output : # v 5 v 5 " : in # in output : v 5 " v 5 " Sutherland-Hodgman, Example v 5 " v 4 v " 4 v 5 : in # in output : v 5 v 5 " v 1 " : in # out output : v 1 " {v 2, v 2 ", v " 4,v 5, v 5 ", v 1 "} v 2 " v " 4 : out # in output : v 2 ", v " 4 v 1 " v 2 : out # out v 1" output : none " v 1 v Feb SMM009, Basics and Clipping 26 L " " v 2 " v 2 v 2 v 2 " : out # out output : none v 5 v 5 " : out # out output : none v 5 " v 5 " v 5 " v 1 " : out # in output : v 5 ", v 1 " Sutherland-Hodgman, Example " " v 1 v 5 { v 2 ", v " 4,v 5, v 5 ", v 1 " } v 2 " v " 4 : in # out v 1 " v 2 " : in # in output : v 2 " " v 4 " " v 2 v " 4 v 5 : out # out output : none output : v 2 " " Feb SMM009, Basics and Clipping 27 L " " " v 2 9

10 Sutherland-Hodgman, Result " " v 5 " " " v 2 " " v 1 " " v 2 Feb SMM009, Basics and Clipping 28 L INSTITUTIONEN FÖR SYSTEMTEKNIK LULEÅ TEKNISKA UNIVERSITET Hidden Surface Removal Feb SMM009, Basics and Clipping 29 L Overview Only certain polygons are visible from a given viewpoint - Clipping removes those outside of the view - However, there may be polygons that are partially or fully hidden by other objects in the view Parts of objects that face away from the viewer do not contribute to scene - Back-face removal Part of objects that are hidden by opaque surfaces do not contribute to the scene - Hidden-surface removal - Visible-surface detection Feb SMM009, Basics and Clipping 30 L 10

11 Back-Face Removal If a surface points away from the viewer A quick way to test is: - It s normal vector also points away v - If the angle θ between the normal n and the vector to the viewer v is -90 θ 90 - Then, the surface is visible. θ n But, θ 90 cos θ 0 n v 0 - If w1, w2, w3 are successive, non-collinear vertices in a right-hand system - n = (w2 -w1) (w3-w1) If one waits until the polygon is transformed into the standard OpenGL viewing volume then - ui = Twi, n = (u2 -u1) (u3-u1), and v = [ ]T - So, we need only test that zn 0 Feb SMM009, Basics and Clipping 31 L 32 L 33 L Hidden-Surface Removal Two approaches - Object-space, consider the objects pair-wise - Image-space, trace a ray back Feb SMM009, Basics and Clipping Object Approaches Naïve comparison - Pick an object, compare it with the n-1 other objects, - Complexity O(n2) Depth sort - For each object find the nearest and furthest points - Sort by increasing depth of far point, break ties with near point - Complexity O(n lg(n)) with an efficient sort Feb SMM009, Basics and Clipping 11

12 Painter s Algorithm A simple variant of depth sorting Back to front rendering Basic algorithm: - Sort the objects (polygons) by decreasing maximum depth - Render the objects in sorted order Complications: - Intersecting objects - Cyclic overlap Feb SMM009, Basics and Clipping 34 L 35 L 36 L Dealing with the Complications We must keep track of extent (nearest point) For each surface, S, which overlaps the depth of the back surface S test: - Do their areas overlap? Is S completely behind? Is S completely in front Does S completely obscure S? If not we must, - Reorder surfaces, or - Compute intersections and divide surfaces Feb SMM009, Basics and Clipping Z-Buffer Algorithm A simple algorithm that relies on an auxiliary memory - Was expensive at one time Algorithm: - Initialize the depth buffer to - - For each polygon + Compute the depth of each pixel as it is scan converted + If the depth is less that the current value in the depth buffer Replace the pixel Update the depth buffer with the pixel s depth Feb SMM009, Basics and Clipping 12

13 Octree Methods If we divided the octree as on the right Then, to render - Do a post order traversal of the tree - Render if the corresponding pixel in the frame buffer is empty Feb SMM009, Basics and Clipping 37 L INSTITUTIONEN FÖR SYSTEMTEKNIK LULEÅ TEKNISKA UNIVERSITET Scan Conversion Feb SMM009, Basics and Clipping 38 L Line Equations The slope intercept form of a line is - y = mx + b - Where the slope m = y end " y 0 x end " x 0 - And, the intercept b = y 0 - mx 0 Can draw a line by evaluating y at every location of x However, this requires a multiplication and addition for every point And, for m > 1 there will be gaps Feb SMM009, Basics and Clipping 39 L 13

14 Digital Difference Analyzers Consider m 1 - For m > 1, we can reverse x and y What if we draw in unit increments - x = x + 1 (y = y + m) - y = y + m (x = x + 1/m) Now, we can rapidly increment between x 0 (y 0 ) and x end (y end ) There are still some inefficiencies - Floating point computations - Rounding to set the right point Feb SMM009, Basics and Clipping 40 L Bresenham s Algorithm Uses only integer operations - One addition per step Can be extended to circles and other curves Key ideas: - Step one pixel at a time - Compute a decision parameter, p, whose sign determines the next point Feb SMM009, Basics and Clipping 41 L Bresenham s for Lines with Slope, 0 m 1 Consider the diagram to the right - An arbitrary point on a line segment is not usually on a display pixel y k - We need to draw the closest point, i.e., with the smaller of d lower or d upper Note, d lower < d upper iff d lower - d upper < 0 So, y k +1 d upper d lower = y " y k = m(x k +1) + b " y k d upper = (y k +1) " y = (y k +1) " m(x k +1) " b d lower " d upper = 2m(x k +1) " 2y k + 2b "1 x k +1 d lower Feb SMM009, Basics and Clipping 42 L 14

15 Bresenham s for Lines, Continued d lower - d upper still contains a division which can be noninteger m = (y " y ) end 0 (x end " x 0 ) #x = (x end " x 0 ),#y = (y end " y 0 ) What if we let p k = Δx(d lower - d upper )? - Removes integer division - And, p k = 2x k "y # 2y k "x + 2"y + "x(2b #1) = 2x k "y # 2y k "x + c Feb SMM009, Basics and Clipping 43 L Bresenham s, Δp, p 0 Now, we need to compute the differences from p k to p k+1 p k+1 = 2"yx k+1 # 2"xy k+1 + c p k = 2"yx k # 2"xy k + c p k+1 " p k = 2#y(x k+1 " x k ) " 2#x(y k+1 " y k ) But, x k+1 = x k +1 so, p k+1 " p k = 2#y " 2#x(y k+1 " y k ) and, p k+1 = p k + 2#y " 2#x(y k+1 " y k ) Note, y k+1 " y k = 0 or 1, depending on which pixel is closer and, p 0 = (2m(x 0 +1) " 2y 0 + 2b "1)#x, but b = y 0 " mx 0 = (2mx 0 + 2m " 2y 0 + 2y 0 " 2mx 0 "1)#x, and m = #y #x = (2m "1)#x = 2#y " #x Feb SMM009, Basics and Clipping 44 L Bresenham s, 0 m 1 Input the end points and set the left one as (x 0,y 0 ) PutPixel(x 0,y 0 ) Compute: - Δx, Δy, 2Δy, & 2Δy - 2Δx - p 0 = 2Δy - Δx x k on the line test - If < 0, then PutPixel(x k +1,y k ) and p k+1 = p k + 2Δy - Else PutPixel(x k +1,y k +1) and p k+1 = p k + 2Δy - 2Δx Stop when x = x end Feb SMM009, Basics and Clipping 45 L 15

16 Bresenham s Example, (21,11) ~ (30,18) k p k (x,y) 0 6 (21,11) 1 2 (22,12) 2-2 (23,12) 3 14 (24,13) 4 10 (25,14) 5 6 (26,15) Δx = 10, Δy = 8, 2Δy =16, 6 2 (27,16) 2Δy-2Δx = -4, 7-2 (28,16) p 0 = 2Δy-Δx = (29,17) 9 10 (30,18) Feb SMM009, Basics and Clipping 46 L Bresenham s, General Lines Consider the symmetry If -1 m 0, then everything is the same except one subtracts 1 from y instead of adding - Can also go in steps of -1 for x starting at x end If m > 1, then swap x and y Completing the algorithm is left as an exercise! Feb SMM009, Basics and Clipping 47 L A circle has equation - (x-x c ) 2 + (y-y c ) 2 = r 2 Drawing Circles - So, y = y c ± r 2 " (x " x c ) 2 Drawing directly has two problems: - The points are not connected - We have to do square root calculations which are expensive Can use an algorithm similar to Bresenham s? Feb SMM009, Basics and Clipping 48 L 16

17 Midpoint Circle Algorithm Two characteristics of a circle can be used to make any algorithm more efficient - A circle is symmetric + If (x,y) in the arc from the y-axis to the line y = x is on the circle, so are the eight combinations of x,y with different signs - A circle can be drawn at (0,0) and translated to (x c,y c ) when drawn So, let f circle (x,y) = x 2 + y 2 - r 2, then - f circle will be <0 inside, =0 on, and >0 outside of the circle Test for the midpoints between pixel positions Feb SMM009, Basics and Clipping 49 L Midpoint Circle Start at (0,r) Assume, we ve just plotted (x k,y k ) We must determine if - (x k +1,y k ), or - (x k +1,y k -1) - Is closer Evaluate the decision parameter at the midpoint between these to pixels - If less than 0, it is inside the circle and is y k closer - Otherwise, y k -1 is closer Feb SMM009, Basics and Clipping 50 L Midpoint Circle, p p k = f circle (x k +1, y k " 1 2 ) = (x k +1) 2 + (y k " 1 2 )2 " r 2 note: x k+1 +1 = x k + 2 " p k+1 = f (x k+1 +1, y k+1 # 1 2 ) = [(x k +1)+1]2 + (y k+1 # 1 2 )2 # r 2 or p k+1 " p k = (x k + 2) 2 " (x k +1) 2 + (y k+1 " 1 2 )2 " (y k " 1 2 )2 2 2 " p k+1 = p k + 2(x k +1)+ (y k+1 # y k ) # (yk+1 # y k )+1 So, "p ={ 2x k+1 +1 p k < 0 2x k+1 +1# 2y k+1 p k $ 0 note: 2x k+1 = 2x k + 2 and 2y k+1 = 2y k " 2 Finally, p 0 = f circle (1,r " 1 2 ) =1+ (r " 1 2 )2 " r 2 = 5 4 " r or 1" r for Integers Feb SMM009, Basics and Clipping 51 L 17

18 Midpoint Circle Algorithm Input radius, r, and center (x c,y c ) Compute p 0 = 1 - r, PutPixel(0,r) for 4 symmetric points x k until x y - If p k < 0, then + Plot point is (x k +1,y k ) + Compute the 8 points and plot them translated to (x c,y c ) + 2x k+1 = 2x k + 2, p k+1 = p k + 2x k Else + Plot point is (x k +1,y k -1) + Compute the 8 points and plot them translated to (x c,y c ) + 2x k+1 = 2x k + 2, 2y k+1 = 2y k - 2, p k+1 = p k + 2x k y k+1 Feb SMM009, Basics and Clipping 52 L Midpoint Circle Example, r=10 k p k (x,y) 2x k+1 2y k (1,10) (2,10) (3,10) (4,9) (5,9) (6,8) (7,7) 14 Feb SMM009, Basics and Clipping 53 L 14 Flood Filling an Area If we have an arbitrary shape in an otherwise empty frame buffer Flood fill will recursively fill the area - Draw the shape - Start at an interior point (x,y) - FloodFill(x,y) + If (x,y) is uncolored Color (x,y) FloodFill(x+1,y), FloodFill(x,y+1), FloodFill(x-1,y), FloodFill(x,y -1) + Else return Feb SMM009, Basics and Clipping 54 L 18

19 INSTITUTIONEN FÖR SYSTEMTEKNIK LULEÅ TEKNISKA UNIVERSITET Antialiasing Feb SMM009, Basics and Clipping 55 L Problem Due to the finite resolution of the screen Line segments and object edges appear saw-toothed This is known as the jaggies Feb SMM009, Basics and Clipping 56 L Two Methods to Solve Super-sampling - Divide each pixel into a number of smaller pixels - Draw the figure - Count the number of smaller pixels drawn in each big pixel - Set the intensity in the big pixel proportional to the percentage of drawn smaller pixels Area sampling - Set each of two adjacent pixels proportional to their percentage coverage - Assumes finite with lines - Pixels can be horizontal or vertical Feb SMM009, Basics and Clipping 57 L 19

20 Supersampling, Considerations Requires extra memory We should probably use finite width lines - Slower performance - Better intensity values We need to consider background colors - If we use 3x3 small pixels - Then, with a red background and a blue line that touches 4 small pixels (5r + 4b) Pixel color = 9 May want to weigh cells differently Feb SMM009, Basics and Clipping 58 L Area Sampling Considerations In principle: - Drawing rectangles for lines - Considering pixels as squares (or rectangles) - Computing the intersecting trapizode - Intensity ~ Area(intersection) / Area(pixel) Extra computation Feb SMM009, Basics and Clipping 59 L Questions? Feb SMM009, Basics and Clipping 60 L 20

Overview. Pipeline implementation I. Overview. Required Tasks. Preliminaries Clipping. Hidden Surface removal

Overview. Pipeline implementation I. Overview. Required Tasks. Preliminaries Clipping. Hidden Surface removal Overview Pipeline implementation I Preliminaries Clipping Line clipping Hidden Surface removal Overview At end of the geometric pipeline, vertices have been assembled into primitives Must clip out primitives

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

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

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

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

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

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 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

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

Clipping. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015 Clipping 1 Objectives Clipping lines First of implementation algorithms Clipping polygons (next lecture) Focus on pipeline plus a few classic algorithms 2 Clipping 2D against clipping window 3D against

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

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

Visible Surface Detection Methods

Visible Surface Detection Methods Visible urface Detection Methods Visible-urface Detection identifying visible parts of a scene (also hidden- elimination) type of algorithm depends on: complexity of scene type of objects available equipment

More information

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

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

Werner Purgathofer

Werner Purgathofer Einführung in Visual Computing 186.822 Visible Surface Detection Werner Purgathofer Visibility in the Rendering Pipeline scene objects in object space object capture/creation ti modeling viewing projection

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

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

3D Rendering Pipeline (for direct illumination)

3D Rendering Pipeline (for direct illumination) Clipping 3D Rendering Pipeline (for direct illumination) 3D Primitives 3D Modeling Coordinates Modeling Transformation Lighting 3D Camera Coordinates Projection Transformation Clipping 2D Screen Coordinates

More information

Hidden-Surface Removal.

Hidden-Surface Removal. Hidden-Surface emoval. Here we need to discover whether an object is visible or another one obscures it. here are two fundamental approaches to remove the hidden surfaces: ) he object-space approach )

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

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

CEng 477 Introduction to Computer Graphics Fall 2007

CEng 477 Introduction to Computer Graphics Fall 2007 Visible Surface Detection CEng 477 Introduction to Computer Graphics Fall 2007 Visible Surface Detection Visible surface detection or hidden surface removal. Realistic scenes: closer objects occludes the

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

Buffers, Textures, Compositing, and Blending. Overview. Buffers. David Carr Virtual Environments, Fundamentals Spring 2005 Based on Slides by E.

Buffers, Textures, Compositing, and Blending. Overview. Buffers. David Carr Virtual Environments, Fundamentals Spring 2005 Based on Slides by E. INSTITUTIONEN FÖR SYSTEMTEKNIK LULEÅ TEKNISKA UNIVERSITET Buffers, Textures, Compositing, and Blending David Carr Virtual Environments, Fundamentals Spring 2005 Based on Slides by E. Angel Compositing,

More information

4.5 VISIBLE SURFACE DETECTION METHODES

4.5 VISIBLE SURFACE DETECTION METHODES 4.5 VISIBLE SURFACE DETECTION METHODES A major consideration in the generation of realistic graphics displays is identifying those parts of a scene that are visible from a chosen viewing position. There

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

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

VISIBILITY & CULLING. Don t draw what you can t see. Thomas Larsson, Afshin Ameri DVA338, Spring 2018, MDH

VISIBILITY & CULLING. Don t draw what you can t see. Thomas Larsson, Afshin Ameri DVA338, Spring 2018, MDH VISIBILITY & CULLING Don t draw what you can t see. Thomas Larsson, Afshin Ameri DVA338, Spring 2018, MDH Visibility Visibility Given a set of 3D objects, which surfaces are visible from a specific point

More information

Today. CS-184: Computer Graphics. Lecture #10: Clipping and Hidden Surfaces. Clipping. Hidden Surface Removal

Today. CS-184: Computer Graphics. Lecture #10: Clipping and Hidden Surfaces. Clipping. Hidden Surface Removal Today CS-184: Computer Graphics Lecture #10: Clipping and Hidden Surfaces!! Prof. James O Brien University of California, Berkeley! V2015-S-10-1.0 Clipping Clipping to view volume Clipping arbitrary polygons

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

Computer Graphics. Bing-Yu Chen National Taiwan University

Computer Graphics. Bing-Yu Chen National Taiwan University Computer Graphics Bing-Yu Chen National Taiwan University Visible-Surface Determination Back-Face Culling The Depth-Sort Algorithm Binary Space-Partitioning Trees The z-buffer Algorithm Scan-Line Algorithm

More information

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo Computer Graphics Bing-Yu Chen National Taiwan University The University of Tokyo Hidden-Surface Removal Back-Face Culling The Depth-Sort Algorithm Binary Space-Partitioning Trees The z-buffer Algorithm

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

Part IV. 2D Clipping

Part IV. 2D Clipping Part IV 2D Clipping The Liang-Barsky algorithm Boolean operations on polygons Outline The Liang-Barsky algorithm Boolean operations on polygons Clipping The goal of clipping is mainly to eliminate parts

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

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

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

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

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

Computer Graphics. Lecture 9 Hidden Surface Removal. Taku Komura

Computer Graphics. Lecture 9 Hidden Surface Removal. Taku Komura Computer Graphics Lecture 9 Hidden Surface Removal Taku Komura 1 Why Hidden Surface Removal? A correct rendering requires correct visibility calculations When multiple opaque polygons cover the same screen

More information

Clipping and Scan Conversion

Clipping and Scan Conversion 15-462 Computer Graphics I Lecture 14 Clipping and Scan Conversion Line Clipping Polygon Clipping Clipping in Three Dimensions Scan Conversion (Rasterization) [Angel 7.3-7.6, 7.8-7.9] March 19, 2002 Frank

More information

Hidden Surface Removal

Hidden Surface Removal Outline Introduction Hidden Surface Removal Hidden Surface Removal Simone Gasparini gasparini@elet.polimi.it Back face culling Depth sort Z-buffer Introduction Graphics pipeline Introduction Modeling Geom

More information

Painter s HSR Algorithm

Painter s HSR Algorithm Painter s HSR Algorithm Render polygons farthest to nearest Similar to painter layers oil paint Viewer sees B behind A Render B then A Depth Sort Requires sorting polygons (based on depth) O(n log n) complexity

More information

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

In today s lecture we ll have a look at: A simple technique The mid-point circle algorithm Drawing Circles In today s lecture we ll have a look at: Circle drawing algorithms A simple technique The mid-point circle algorithm Polygon fill algorithms Summary raster drawing algorithms A Simple Circle

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

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

Rasterization and Graphics Hardware. Not just about fancy 3D! Rendering/Rasterization. The simplest case: Points. When do we care? Where does a picture come from? Rasterization and Graphics Hardware CS559 Course Notes Not for Projection November 2007, Mike Gleicher Result: image (raster) Input 2D/3D model of the world Rendering term

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

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

Page 1. Area-Subdivision Algorithms z-buffer Algorithm List Priority Algorithms BSP (Binary Space Partitioning Tree) Scan-line Algorithms Visible Surface Determination Visibility Culling Area-Subdivision Algorithms z-buffer Algorithm List Priority Algorithms BSP (Binary Space Partitioning Tree) Scan-line Algorithms Divide-and-conquer strategy:

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

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

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

Computer Graphics. Chapter 4 Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1 Computer Graphics Chapter 4 Attributes of Graphics Primitives Somsak Walairacht, Computer Engineering, KMITL 1 Outline OpenGL State Variables Point Attributes Line Attributes Fill-Area Attributes Scan-Line

More information

Hidden surface removal. Computer Graphics

Hidden surface removal. Computer Graphics Lecture Hidden Surface Removal and Rasterization Taku Komura Hidden surface removal Drawing polygonal faces on screen consumes CPU cycles Illumination We cannot see every surface in scene We don t want

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

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

Surface shading: lights and rasterization. Computer Graphics CSE 167 Lecture 6 Surface shading: lights and rasterization Computer Graphics CSE 167 Lecture 6 CSE 167: Computer Graphics Surface shading Materials Lights Rasterization 2 Scene data Rendering pipeline Modeling and viewing

More information

Identifying those parts of a scene that are visible from a chosen viewing position, and only process (scan convert) those parts

Identifying those parts of a scene that are visible from a chosen viewing position, and only process (scan convert) those parts Visible Surface Detection Identifying those parts of a scene that are visible from a chosen viewing position, and only process (scan convert) those parts Two approaches: 1. Object space methods 2. Image

More information

8. Hidden Surface Elimination

8. Hidden Surface Elimination 8. Hidden Surface Elimination Identification and Removal of parts of picture that are not visible from a chosen viewing position. 1 8. Hidden Surface Elimination Basic idea: Overwriting Paint things in

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

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

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

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

Clipping Lines. Dr. Scott Schaefer

Clipping Lines. Dr. Scott Schaefer Clipping Lines Dr. Scott Schaefer Why Clip? We do not want to waste time drawing objects that are outside of viewing window (or clipping window) 2/94 Clipping Points Given a point (x, y) and clipping window

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

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

Computer Graphics. Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1 Computer Graphics Chapter 4 Attributes of Graphics Primitives Somsak Walairacht, Computer Engineering, KMITL 1 Outline OpenGL State Variables Point Attributes t Line Attributes Fill-Area Attributes Scan-Line

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

Two-Dimensional Viewing. Chapter 6

Two-Dimensional Viewing. Chapter 6 Two-Dimensional Viewing Chapter 6 Viewing Pipeline Two-Dimensional Viewing Two dimensional viewing transformation From world coordinate scene description to device (screen) coordinates Normalization and

More information

Rasterization, Depth Sorting and Culling

Rasterization, Depth Sorting and Culling Rasterization, Depth Sorting and Culling Rastrerzation How can we determine which pixels to fill? Reading Material These slides OH 17-26, OH 65-79 and OH 281-282, by Magnus Bondesson You may also read

More information

Computer Graphics II

Computer Graphics II Computer Graphics II Autumn 2017-2018 Outline Visible Surface Determination Methods (contd.) 1 Visible Surface Determination Methods (contd.) Outline Visible Surface Determination Methods (contd.) 1 Visible

More information

9. Visible-Surface Detection Methods

9. Visible-Surface Detection Methods 9. Visible-Surface Detection Methods More information about Modelling and Perspective Viewing: Before going to visible surface detection, we first review and discuss the followings: 1. Modelling Transformation:

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

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

CSE528 Computer Graphics: Theory, Algorithms, and Applications

CSE528 Computer Graphics: Theory, Algorithms, and Applications CSE528 Computer Graphics: Theory, Algorithms, and Applications Hong Qin State University of New York at Stony Brook (Stony Brook University) Stony Brook, New York 11794--4400 Tel: (631)632-8450; Fax: (631)632-8334

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

EECE 478. Learning Objectives. Learning Objectives. Rasterization & Scenes. Rasterization. Compositing

EECE 478. Learning Objectives. Learning Objectives. Rasterization & Scenes. Rasterization. Compositing EECE 478 Rasterization & Scenes Rasterization Learning Objectives Be able to describe the complete graphics pipeline. Describe the process of rasterization for triangles and lines. Compositing Manipulate

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

CSE328 Fundamentals of Computer Graphics: Concepts, Theory, Algorithms, and Applications

CSE328 Fundamentals of Computer Graphics: Concepts, Theory, Algorithms, and Applications CSE328 Fundamentals of Computer Graphics: Concepts, Theory, Algorithms, and Applications Hong Qin Stony Brook University (SUNY at Stony Brook) Stony Brook, New York 11794-4400 Tel: (631)632-8450; Fax:

More information

Lab Manual. Computer Graphics. T.E. Computer. (Sem VI)

Lab Manual. Computer Graphics. T.E. Computer. (Sem VI) Lab Manual Computer Graphics T.E. Computer (Sem VI) Index Sr. No. Title of Programming Assignments Page No. 1. Line Drawing Algorithms 3 2. Circle Drawing Algorithms 6 3. Ellipse Drawing Algorithms 8 4.

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

CHAPTER 1 Graphics Systems and Models 3

CHAPTER 1 Graphics Systems and Models 3 ?????? 1 CHAPTER 1 Graphics Systems and Models 3 1.1 Applications of Computer Graphics 4 1.1.1 Display of Information............. 4 1.1.2 Design.................... 5 1.1.3 Simulation and Animation...........

More information

Drawing the Visible Objects

Drawing the Visible Objects Drawing the Visible Objects We want to generate the image that the eye would see, given the objects in our space How do we draw the correct object at each pixel, given that some objects may obscure others

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

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

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

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

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

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

Last Time: Acceleration Data Structures for Ray Tracing. Schedule. Today. Shadows & Light Sources. Shadows Last Time: Acceleration Data Structures for Ray Tracing Modeling Transformations Illumination (Shading) Viewing Transformation (Perspective / Orthographic) Clipping Projection (to Screen Space) Scan Conversion

More information

Computer Graphics: Graphics Output Primitives Line Drawing Algorithms

Computer Graphics: Graphics Output Primitives Line Drawing Algorithms Computer Graphics: Graphics Output Primitives Line Drawing Algorithms By: A. H. Abdul Hafez Abdul.hafez@hku.edu.tr, 1 Outlines 1. Basic concept of lines in OpenGL 2. Line Equation 3. DDA Algorithm 4. DDA

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

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

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

521493S Computer Graphics Exercise 1 (Chapters 1-3) 521493S Computer Graphics Exercise 1 (Chapters 1-3) 1. Consider the clipping of a line segment defined by the latter s two endpoints (x 1, y 1 ) and (x 2, y 2 ) in two dimensions against a rectangular

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

(Refer Slide Time 03:00)

(Refer Slide Time 03:00) Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture #30 Visible Surface Detection (Contd ) We continue the discussion on Visible

More information

8. Hidden Surface Elimination

8. Hidden Surface Elimination -04-8 Hidden Surface Elimination To eliminate edges and surfaces not visible to the viewer Two categories: Object space methods: Image space methods: deal with object definitions directly Order the surfaces

More information

CS2401 COMPUTER GRAPHICS ANNA UNIV QUESTION BANK

CS2401 COMPUTER GRAPHICS ANNA UNIV QUESTION BANK CS2401 Computer Graphics CS2401 COMPUTER GRAPHICS ANNA UNIV QUESTION BANK CS2401- COMPUTER GRAPHICS UNIT 1-2D PRIMITIVES 1. Define Computer Graphics. 2. Explain any 3 uses of computer graphics applications.

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

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

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane Rendering Pipeline Rendering Converting a 3D scene to a 2D image Rendering Light Camera 3D Model View Plane Rendering Converting a 3D scene to a 2D image Basic rendering tasks: Modeling: creating the world

More information

Pipeline and Rasterization. COMP770 Fall 2011

Pipeline and Rasterization. COMP770 Fall 2011 Pipeline and Rasterization COMP770 Fall 2011 1 The graphics pipeline The standard approach to object-order graphics Many versions exist software, e.g. Pixar s REYES architecture many options for quality

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

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

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

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