# FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

Size: px
Start display at page:

Download "FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU"

Transcription

1 FROM VERTICES TO FRAGMENTS Lecture 5 Comp3080 Computer Graphics HKBU

2 OBJECTIVES Introduce basic implementation strategies Clipping Scan conversion OCTOBER 9,

3 OVERVIEW At end of the geometric pipeline, vertices have been assembled into primitives Must clip out primitives that are outside the view frustum Algorithms based on representing primitives by lists of vertices Must find which pixels can be affected by each primitive Fragment generation Rasterization or scan conversion OCTOBER 9,

4 REQUIRED TASKS Clipping Rasterization or scan conversion Some tasks deferred until fragment processing Hidden surface removal Antialiasing Transformations OCTOBER 9,

5 RASTERIZATION META ALGORITHMS Consider two approaches to rendering a scene with opaque objects For every pixel, determine which object that projects on the pixel is closest to the viewer and compute the shade of this pixel Ray tracing paradigm For every object, determine which pixels it covers and shade these pixels Pipeline approach Must keep track of depths OCTOBER 9,

6 CLIPPING 2D against clipping window Easy for line segments polygons 3D against clipping volume Hard for curves and text Convert to lines and polygons first OCTOBER 9,

7 CLIPPING 2D LINE SEGMENTS Brute force approach: compute intersections with all sides of clipping window Inefficient: one division per intersection OCTOBER 9,

8 COHEN-SUTHERLAND ALGORITHM Idea: eliminate as many cases as possible without computing intersections Start with four lines that determine the sides of the clipping window y = y max x = x min x = x max y = y min OCTOBER 9,

9 THE CASES Case 1: Both endpoints of line segment inside all four lines Draw (accept) line segment as is Case 2: Both endpoints outside all lines and on same side of a line Discard (reject) the line segment y = y max x = x min x = x max y = y min OCTOBER 9,

10 THE CASES Case 3: One endpoint inside, one outside Must do at least one intersection Case 4: Both outside May have part inside Must do at least one intersection y = y max x = x min x = x max OCTOBER 9,

11 DEFINING OUTCODES For each endpoint, define an outcode b 0 b 1 b 2 b 3 b 0 = 1 if y > y max, 0 otherwise b 1 = 1 if y < y min, 0 otherwise b 2 = 1 if x > x max, 0 otherwise b 3 = 1 if x < x min, 0 otherwise Outcodes divide space into 9 regions Computation of outcode requires at most 4 subtractions OCTOBER 9,

12 USING OUTCODES Consider the 5 cases below AB: outcode(a) = outcode(b) = 0 Accept line segment OCTOBER 9,

13 USING OUTCODES CD: outcode (C) = 0, outcode(d) 0 Compute intersection Location of 1 in outcode(d) determines which edge to intersect with Note if there were a segment from A to a point in a region with 2 ones in outcode, we might have to do two intersections OCTOBER 9,

14 USING OUTCODES EF: outcode(e) logically ANDed with outcode(f) (bitwise) 0 Both outcodes have a 1 bit in the same place Line segment is outside of corresponding side of clipping window reject OCTOBER 9,

15 USING OUTCODES GH and IJ: same outcodes, neither zero but logical AND yields zero Shorten line segment by intersecting with one of sides of window Compute outcode of intersection (new endpoint of shortened line segment) Reexecute algorithm OCTOBER 9,

16 EFFICIENCY In many applications, the clipping window is small relative to the size of the entire data base Most line segments are outside one or more side of the window and can be eliminated based on their outcodes Inefficiency when code has to be reexecuted for line segments that must be shortened in more than one step OCTOBER 9,

17 COHEN SUTHERLAND IN 3D Use 6-bit outcodes When needed, clip line segment against planes OCTOBER 9,

18 LIANG-BARSKY CLIPPING Consider the parametric form of a line segment p(α) = (1 - α)p 1 + αp 2 1 α 0 p 2 p 1 We can distinguish between the cases by looking at the ordering of the values of α where the line determined by the line segment crosses the lines that determine the window OCTOBER 9,

19 LIANG-BARSKY CLIPPING In (a): α 4 > α 3 > α 2 > α 1 Intersect right, top, left, bottom: shorten In (b): α 4 > α 2 > α 3 > α 1 Intersect right, left, top, bottom: reject OCTOBER 9,

20 ADVANTAGES Can accept/reject as easily as with Cohen-Sutherland Using values of α, we do not have to use algorithm recursively as with C-S Extends to 3D OCTOBER 9,

21 CLIPPING AND NORMALIZATION General clipping in 3D requires intersection of line segments against arbitrary plane Example: oblique view OCTOBER 9,

22 PLANE-LINE INTERSECTIONS a n n ( ( p p o 2 p p 1 1 ) ) OCTOBER 9,

23 NORMALIZED FORM top view before normalization after normalization Normalization is part of viewing (pre clipping) but after normalization, we clip against sides of right parallelepiped Typical intersection calculation now requires only a floating point subtraction, e.g. is x > x max? OCTOBER 9,

24 POLYGON CLIPPING AND HIDDEN SURFACE REMOVAL OCTOBER 9,

25 POLYGON CLIPPING Not as simple as line segment clipping Clipping a line segment yields at most one line segment Clipping a polygon can yield multiple polygons However, clipping a convex polygon can yield at most one other polygon OCTOBER 9,

26 TESSELLATION AND CONVEXITY One strategy is to replace nonconvex (concave) polygons with a set of triangular polygons (a tessellation) Also makes fill easier Tessellation code in GLU library OCTOBER 9,

27 CLIPPING AS A BLACK BOX Can consider line segment clipping as a process that takes in two vertices and produces either no vertices or the vertices of a clipped line segment OCTOBER 9,

28 PIPELINE CLIPPING OF LINE SEGMENTS Clipping against each side of window is independent of other sides Can use four independent clippers in a pipeline OCTOBER 9,

29 PIPELINE CLIPPING OF POLYGONS Three dimensions: add front and back clippers Strategy used in SGI Geometry Engine Small increase in latency OCTOBER 9,

30 BOUNDING BOXES Rather than doing clipping on a complex polygon, we can use an axis-aligned bounding box or extent Smallest rectangle aligned with axes that encloses the polygon Simple to compute: max and min of x and y OCTOBER 9,

31 BOUNDING BOXES Can usually determine accept/reject based only on bounding box accept reject requires detailed clipping OCTOBER 9,

32 CLIPPING AND VISIBILITY Clipping has much in common with hidden-surface removal In both cases, we are trying to remove objects that are not visible to the camera Often we can use visibility or occlusion testing early in the process to eliminate as many polygons as possible before going through the entire pipeline OCTOBER 9,

33 HIDDEN SURFACE REMOVAL Object-space approach: use pairwise testing between polygons (objects) partially obscuring can draw independently Worst case complexity O(n 2 ) for n polygons OCTOBER 9,

34 PAINTER S ALGORITHM Render polygons a back to front order so that polygons behind others are simply painted over B behind A as seen by viewer Fill B then A OCTOBER 9,

35 DEPTH SORT Requires ordering of polygons first O(n log n) calculation for ordering Not every polygon is either in front or behind all other polygons Order polygons and deal with easy cases first, harder later Polygons sorted by distance from COP OCTOBER 9,

36 EASY CASES A lies behind all other polygons Can render Polygons overlap in z but not in either x or y Can render independently OCTOBER 9,

37 HARD CASES Overlap in all directions but can one is fully on one side of the other cyclic overlap penetration OCTOBER 9,

38 BACK-FACE REMOVAL (CULLING) Face is visible iff 90 θ -90 equivalently cosθ 0 or v n 0 Plane of face has form ax + by + cz + d = 0 but after normalization n = ( ) T Need only test the sign of c In OpenGL we can simply enable culling but may not work correctly if we have nonconvex objects OCTOBER 9,

39 IMAGE SPACE APPROACH Look at each projector (nm for an n m frame buffer) and find closest of k polygons Complexity O(nmk) Ray tracing z-buffer OCTOBER 9,

40 Z-BUFFER ALGORITHM Use a buffer called the z or depth buffer to store the depth of the closest object at each pixel found so far As we render each polygon, compare the depth of each pixel to depth in z buffer If less, place shade of pixel in color buffer and update z buffer OCTOBER 9,

41 EFFICIENCY If we work scan line by scan line as we move across a scan line, the depth changes satisfy a x + b y + c z = 0 Along scan line y = 0 z = - a c x In screen space x = 1 OCTOBER 9,

42 SCAN-LINE ALGORITHM Can combine shading and hsr through scan line algorithm scan line i: no need for depth information, can only be in no or one polygon scan line j: need depth information only when in more than one polygon OCTOBER 9,

43 IMPLEMENTATION Need a data structure to store Flag for each polygon (inside/outside) Incremental structure for scan lines that stores which edges are encountered Parameters for planes OCTOBER 9,

44 VISIBILITY TESTING In many realtime applications, such as games, we want to eliminate as many objects as possible within the application Reduce burden on pipeline Reduce traffic on bus Partition space with Binary Spatial Partition (BSP) Tree OCTOBER 9,

45 SIMPLE EXAMPLE consider 6 parallel polygons top view The plane of A separates B and C from D, E and F OCTOBER 9,

46 BSP TREE Can continue recursively Plane of C separates B from A Plane of D separates E and F Can put this information in a BSP tree Use for visibility and occlusion testing OCTOBER 9,

47 LINE DRAWING ALGORITHMS AND ANTIALIASING OCTOBER 9,

48 RASTERIZATION Rasterization (scan conversion) Determine which pixels that are inside primitive specified by a set of vertices Produces a set of fragments Fragments have a location (pixel location) and other attributes such color and texture coordinates that are determined by interpolating values at vertices Pixel colors determined later using color, texture, and other vertex properties OCTOBER 9,

49 SCAN CONVERSION OF LINE SEGMENTS Start with line segment in window coordinates with integer values for endpoints Assume implementation has a write_pixel function y m x y = mx + h OCTOBER 9,

50 DDA ALGORITHM Digital Differential Analyzer DDA was a mechanical device for numerical solution of differential equations Line y = mx + h satisfies differential equation dy/dx = m = Dy/Dx = (y 2 - y 1 )/(x 2 - x 1 ) Along scan line Dx = 1 For(x = x1; x <= x2, ix++) { y += m; write_pixel(x, round(y), line_color) } OCTOBER 9,

51 PROBLEM DDA = for each x plot pixel at closest y Problems for steep lines OCTOBER 9,

52 USING SYMMETRY Use for 1 m 0 For m > 1, swap role of x and y For each y, plot closest x OCTOBER 9,

53 BRESENHAM S ALGORITHM DDA requires one floating point addition per step Assume pixel centers are at half integers We can eliminate all fp through Bresenham s algorithm Consider only 1 m 0 Other cases by symmetry If we start at a pixel that has been written, there are only two candidates for the next pixel to be written into the frame buffer OCTOBER 9,

54 CANDIDATE PIXELS 1 m 0 candidates last pixel Note that line could have passed through any part of this pixel OCTOBER 9,

55 DECISION VARIABLE d = Dx(b - a) d is an integer d > 0 use upper pixel d < 0 use lower pixel OCTOBER 9,

56 INCREMENTAL FORM More efficient if we look at d k, the value of the decision variable at x = k d k+1 = d k 2Dy, if d k < 0 d k+1 = d k 2(Dy - Dx), otherwise For each x, we need do only an integer addition and a test Single instruction on graphics chips OCTOBER 9,

57 POLYGON SCAN CONVERSION Scan Conversion = Fill How to tell inside from outside Convex easy Nonsimple difficult Odd even test Count edge crossings Winding number odd-even fill OCTOBER 9,

58 WINDING NUMBER Count clockwise encirclements of point winding number = 1 winding number = 2 Alternate definition of inside: inside if winding number 0 OCTOBER 9,

59 FILLING IN THE FRAME BUFFER Fill at end of pipeline Convex Polygons only Nonconvex polygons assumed to have been tessellated Shades (colors) have been computed for vertices (Gouraud shading) Combine with z-buffer algorithm March across scan lines interpolating shades Incremental work small OCTOBER 9,

60 USING INTERPOLATION C 1 C 2 C 3 specified by glcolor or by vertex shading C 4 determined by interpolating between C 1 and C 2 C 5 determined by interpolating between C 2 and C 3 Interpolate between C 4 and C 5 along span C 1 scan line C 4 C 2 C 5 span C 3 OCTOBER 9,

61 FLOOD FILL Fill can be done recursively if we know a seed point located inside (WHITE) Scan convert edges into buffer in edge/inside color (BLACK) flood_fill(int x, int y) { if(read_pixel(x, y) == WHITE) { write_pixel(x, y, BLACK); flood_fill(x-1, y); flood_fill(x+1, y); flood_fill(x, y+1); flood_fill(x, y-1); } } OCTOBER 9,

62 SCAN LINE FILL Can also fill by maintaining a data structure of all intersections of polygons with scan lines Sort by scan line Fill each span vertex order generated by vertex list desired order OCTOBER 9,

63 DATA STRUCTURE OCTOBER 9,

64 ALIASING Ideal rasterized line should be 1 pixel wide Choosing best y for each x (or visa versa) produces aliased raster lines OCTOBER 9,

65 ANTIALIASING BY AREA AVERAGING Color multiple pixels for each x depending on coverage by ideal line original antialiased magnified OCTOBER 9,

66 POLYGON ALIASING Aliasing problems can be serious for polygons Jaggedness of edges Small polygons neglected Need compositing so color of one polygon does not totally determine color of pixel All three polygons should contribute to color OCTOBER 9,

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

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

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

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

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

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

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

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

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

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

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

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

### Introduction to Computer Graphics 5. Clipping

Introduction to Computer Grapics 5. Clipping I-Cen Lin, Assistant Professor National Ciao Tung Univ., Taiwan Textbook: E.Angel, Interactive Computer Grapics, 5 t Ed., Addison Wesley Ref:Hearn and Baker,

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

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

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

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

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

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

15-462 Computer Graphics I Lecture 14 Rasterization March 13, 2003 Frank Pfenning Carnegie Mellon University http://www.cs.cmu.edu/~fp/courses/graphics/ Scan Conversion Antialiasing Compositing [Angel,

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

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

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

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

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

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

### Examples. Clipping. The Rendering Pipeline. View Frustum. Normalization. How it is done. Types of operations. Removing what is not seen on the screen

Computer Graphics, Lecture 0 November 7, 006 Eamples Clipping Types of operations Accept Reject Clip Removing what is not seen on the screen The Rendering Pipeline The Graphics pipeline includes one stage

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

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

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

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

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

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

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

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

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

### CS4620/5620: Lecture 14 Pipeline

CS4620/5620: Lecture 14 Pipeline 1 Rasterizing triangles Summary 1! evaluation of linear functions on pixel grid 2! functions defined by parameter values at vertices 3! using extra parameters to determine

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

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

### Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology A tool needed for the graphics people all the time Very important components: Need to make them fast! Finding if

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

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

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

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

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

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

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

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

### Computer Graphics and GPGPU Programming

Computer Graphics and GPGPU Programming Donato D Ambrosio Department of Mathematics and Computer Science and Center of Excellence for High Performace Computing Cubo 22B, University of Calabria, Rende 87036,

### S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T Copyright 2018 Sung-eui Yoon, KAIST freely available on the internet http://sglab.kaist.ac.kr/~sungeui/render

### QUESTION BANK 10CS65 : COMPUTER GRAPHICS AND VISUALIZATION

QUESTION BANK 10CS65 : COMPUTER GRAPHICS AND VISUALIZATION INTRODUCTION OBJECTIVE: This chapter deals the applications of computer graphics and overview of graphics systems and imaging. UNIT I 1 With clear

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

### Graphics and Interaction Rendering pipeline & object modelling

433-324 Graphics and Interaction Rendering pipeline & object modelling Department of Computer Science and Software Engineering The Lecture outline Introduction to Modelling Polygonal geometry The rendering

### CSE 167: Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

CSE 167: Introduction to Computer Graphics Lecture #5: Rasterization Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012 Announcements Homework project #2 due this Friday, October

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

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

### Visibility: Z Buffering

University of British Columbia CPSC 414 Computer Graphics Visibility: Z Buffering Week 1, Mon 3 Nov 23 Tamara Munzner 1 Poll how far are people on project 2? preferences for Plan A: status quo P2 stays

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

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

### Rendering the Teapot 1

Rendering the Teapot 1 Utah Teapot 2 Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015 vertices.js var numteapotvertices = 306; var vertices = [ vec3(1.4, 0.0, 2.4), vec3(1.4, -0.784,

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

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

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

### Computer Graphics Geometry and Transform

! Computer Graphics 2014! 5. Geometry and Transform Hongxin Zhang State Key Lab of CAD&CG, Zhejiang University 2014-10-11! Today outline Triangle rasterization Basic vector algebra ~ geometry! Antialiasing

### Clipping & Culling. Lecture 11 Spring Trivial Rejection Outcode Clipping Plane-at-a-time Clipping Backface Culling

Clipping & Culling Trivial Rejection Outcode Clipping Plane-at-a-time Clipping Backface Culling Lecture 11 Spring 2015 What is Clipping? Clipping is a procedure for spatially partitioning geometric primitives,

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

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

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

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

### Computer Graphics (CS 543) Lecture 9 (Part 2): Clipping. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Computer Graphics (CS 543) Lecture 9 (Part 2): Clipping Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) OpenGL Stages After projection, several stages before objects drawn

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

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

### Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL

International Edition Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL Sixth Edition Edward Angel Dave Shreiner Interactive Computer Graphics: A Top-Down Approach with Shader-Based

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

### Computer Graphics. Rendering. by Brian Wyvill University of Calgary. cpsc/enel P 1

Computer Graphics Rendering by Brian Wyvill University of Calgary cpsc/enel P Rendering Techniques Wire Frame Z Buffer Ray Tracing A Buffer cpsc/enel P 2 Rendering Visible Surface Determination Many Algorithms,

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

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

Visible-Surface Detection Methods Chapter? Intro. to Computer Graphics Spring 2008, Y. G. Shin The Visibility Problem [Problem Statement] GIVEN: a set of 3-D surfaces, a projection from 3-D to 2-D screen,

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

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

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

### Hidden Surfaces II. Week 9, Mon Mar 15

University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Hidden Surfaces II Week 9, Mon Mar 15 http://www.ugrad.cs.ubc.ca/~cs314/vjan2010 ews yes, I'm granting the request

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

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

### Two basic types: image-precision and object-precision. Image-precision For each pixel, determine which object is visable Requires np operations

walters@buffalo.edu CSE 480/580 Lecture 21 Slide 1 Visible-Surface Determination (Hidden Surface Removal) Computationaly expensive Two basic types: image-precision and object-precision For n objects and

### CS 498 VR. Lecture 18-4/4/18. go.illinois.edu/vrlect18

CS 498 VR Lecture 18-4/4/18 go.illinois.edu/vrlect18 Review and Supplement for last lecture 1. What is aliasing? What is Screen Door Effect? 2. How image-order rendering works? 3. If there are several

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

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

Rasterization CS 4620 Lecture 16 1 Announcements A3 due on Thu Will send mail about grading once finalized 2 Pipeline overview you are here APPLICATION COMMAND STREAM 3D transformations; shading VERTEX

### Computing Visibility. Backface Culling for General Visibility. One More Trick with Planes. BSP Trees Ray Casting Depth Buffering Quiz

Computing Visibility BSP Trees Ray Casting Depth Buffering Quiz Power of Plane Equations We ve gotten a lot of mileage out of one simple equation. Basis for D outcode-clipping Basis for plane-at-a-time

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

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

### Direct Rendering of Trimmed NURBS Surfaces

Direct Rendering of Trimmed NURBS Surfaces Hardware Graphics Pipeline 2/ 81 Hardware Graphics Pipeline GPU Video Memory CPU Vertex Processor Raster Unit Fragment Processor Render Target Screen Extended

### Pipeline Operations. CS 4620 Lecture 10

Pipeline Operations CS 4620 Lecture 10 2008 Steve Marschner 1 Hidden surface elimination Goal is to figure out which color to make the pixels based on what s in front of what. Hidden surface elimination

### Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

Pipeline Operations CS 4620 Lecture 11 1 Pipeline you are here APPLICATION COMMAND STREAM 3D transformations; shading VERTEX PROCESSING TRANSFORMED GEOMETRY conversion of primitives to pixels RASTERIZATION

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

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

### Computer Graphics I Lecture 11

15-462 Computer Graphics I Lecture 11 Midterm Review Assignment 3 Movie Midterm Review Midterm Preview February 26, 2002 Frank Pfenning Carnegie Mellon University http://www.cs.cmu.edu/~fp/courses/graphics/

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

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

### CSE 167: Introduction to Computer Graphics Lecture #9: Visibility. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2018

CSE 167: Introduction to Computer Graphics Lecture #9: Visibility Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2018 Announcements Midterm Scores are on TritonEd Exams to be

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