Prof. Feng Liu. Fall /25/2018

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

OUTPUT PRIMITIVES. CEng 477 Introduction to Computer Graphics METU, 2007

Graphics Output Primitives

Rasterization: Geometric Primitives

CSC Computer Graphics

GRAPHICS OUTPUT PRIMITIVES

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

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

Scan Conversion. Drawing Lines Drawing Circles

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

Computer Graphics. Modelling in 2D. 2D primitives. Lines and Polylines. OpenGL polygon primitives. Special polygons

Line Drawing. Foundations of Computer Graphics Torsten Möller

Computer Graphics. Lecture 3 Graphics Output Primitives. Somsak Walairacht, Computer Engineering, KMITL

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

CS 450: COMPUTER GRAPHICS RASTERIZING LINES SPRING 2016 DR. MICHAEL J. REALE

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

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

UNIT -8 IMPLEMENTATION

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

Derivatives 3: The Derivative as a Function

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

CPSC / Scan Conversion

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

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

CS 543: Computer Graphics. Rasterization

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

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

MATH 115: Review for Chapter 1

Alternate Angles. Clip 67. Mathswatch

Scan Converting Lines

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

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

MATH STUDENT BOOK. 10th Grade Unit 9

Computer Graphics: Graphics Output Primitives Line Drawing Algorithms

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

0 COORDINATE GEOMETRY

12.4 The Ellipse. Standard Form of an Ellipse Centered at (0, 0) (0, b) (0, -b) center

Section 4.2 Graphing Lines

Line Drawing Week 6, Lecture 9

Rendering approaches. 1.image-oriented. 2.object-oriented. foreach pixel... 3D rendering pipeline. foreach object...

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

Chapter - 2: Geometry and Line Generations

Lines and Their Slopes

From Ver(ces to Fragments: Rasteriza(on

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

Graphics (Output) Primitives. Chapters 3 & 4

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

Unit 2: Function Transformation Chapter 1

CS 325 Computer Graphics

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

Transformation of curve. a. reflect the portion of the curve that is below the x-axis about the x-axis

SLOPE A MEASURE OF STEEPNESS through 7.1.5

CS 130 Final. Fall 2015

GRAPHING QUADRATIC FUNCTIONS IN STANDARD FORM

(Refer Slide Time: 00:03:51)

Rasterization. CS4620 Lecture 13

LESSON 3.1 INTRODUCTION TO GRAPHING

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

UNIT 2 GRAPHIC PRIMITIVES

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

Rasterization. COMP 575/770 Spring 2013

Midpoint and Distance Formulas

= secant lines of the n+1 unit circle divisions (d)

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

The graphics pipeline. Pipeline and Rasterization. Primitives. Pipeline

Shape 3 Assessment Calculator allowed for all questions

Midterm Review. Wen-Chieh (Steve) Lin Department of Computer Science

Topic #1: Rasterization (Scan Conversion)

Display Technologies: CRTs Raster Displays

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

CS Rasterization. Junqiao Zhao 赵君峤

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

Reteaching Golden Ratio

MODULE - 4. e-pg Pathshala

1 Introduction to Graphics

Algebra I. Linear Equations. Slide 1 / 267 Slide 2 / 267. Slide 3 / 267. Slide 3 (Answer) / 267. Slide 4 / 267. Slide 5 / 267

Painter s HSR Algorithm

Scan Conversion- Polygons

Pipeline and Rasterization. COMP770 Fall 2011

Graphing Calculator Graphing with the TI-86

1) y = 2x 7 2) (-2, 3) ( 3, -1) 3) table. 4) y 5 = ½ ( x 4) 5) 2x + 4y = 7 6) y = 5 7) 8) 9) (-1, 5) (0, 4) 10) y = -3x 7. 11) 2y = -3x 5 12) x = 5

Computer Graphics. - Rasterization - Philipp Slusallek

Aliasing. Can t draw smooth lines on discrete raster device get staircased lines ( jaggies ):

CS 335 Graphics and Multimedia. Geometric Warping

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

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

Test Name: Chapter 3 Review

Intermediate Algebra. Gregg Waterman Oregon Institute of Technology

Math 125 Little Book Homework Chapters 7, 10, 11, and 12

Lesson 11 Skills Maintenance. Activity 1. Model. The addition problem is = 4. The subtraction problem is 5 9 = 4.

Einführung in Visual Computing

Chapter 2: Introduction to Functions

Lecture 6 of 41. Scan Conversion 1 of 2: Midpoint Algorithm for Lines and Ellipses

Lecture 6 of 41. Scan Conversion 1 of 2: Midpoint Algorithm for Lines and Ellipses

x=2 26. y 3x Use calculus to find the area of the triangle with the given vertices. y sin x cos 2x dx 31. y sx 2 x dx

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

CS-321 Thursday 12 September 2002 Quiz (3 pts.) What is the purpose of a control grid in a cathode ray tube (CRT)?

Translations, Reflections, and Rotations

1.2 Visualizing and Graphing Data

Midpoint of a Line Segment. INVESTIGATE the Math

Transcription:

Prof. Feng Liu Fall 08 http://www.cs.pd.edu/~fliu/courses/cs7/ 0/5/08

Last time Clipping

Toda Rasterization In-class Mid-term November Close-book eam Notes on page of A or Letter size paper

Where We Stand At this point we know how to: Convert points from local to screen coordinates Clip polgons and lines to the view volume Net thing: Determine which piels to fill for an given point, line or polgon

Drawing Points When points are mapped into window coordinates, the could land anwhere not just at a piel center Solution is the simple, obvious one Map to window space Fill the closest piel Can also specif a radius fill a square of that size, or fill a circle Square is faster 5

Drawing Points () 7 6 5 5 6 7 8 6

Drawing Lines Task: Decide which piels to fill (samples to use) to represent a line We know that all of the line lies inside the visible region (clipping gave us this!) 7

Line Drawing Algorithms Consider lines of the form =m + c, where m=/, 0<m<, integer coordinates All others follow b smmetr, modif for real numbers Variet of slow algorithms (Wh slow?): step, compute new at each step b equation, rounding: step, compute new at each step b adding m to old, rounding: i, i round ( mi b), round ( ) i i i i i m 8

Bresenham s Algorithm Overview Aim: For each, plot the piel whose -value is closest to the line Given ( i, i ), must choose from either ( i +, i +) or ( i +, i ) Idea: compute a decision variable Value that will determine which piel to draw Eas to update from one piel to the net Bresenham s algorithm is the midpoint algorithm for lines Other midpoint algorithms for conic sections (circles, ellipses) 9

Midpoint Methods Consider the midpoint between ( i +, i +) and ( i +, i ) If it s above the line, we choose ( i +, i ), otherwise we choose ( i +, i +) i + i + i i i i + i i + Choose ( i +, i ) Choose ( i +, i +) 0

Midpoint Decision Variable Write the line from (, ) to (, ) in implicit form: F, a b c Assume <= = -, = - The value of F(,) tells us where points are with respect to the line F(,)=0: the point is on the line F(,)>0: The point is above the line F(,)<0: The point is below the line The decision variable is the value of d i = F( i +, i +0.5) The factor of two makes the math easier

What Can We Decide? d i i ( i ) d i positive=> net point at ( i +, i ) d i negative => net point at ( i +, i +) At each point, we compute d i and decide which piel to draw How do we update it? What is d i+?

Updating The Decision Variable d k+ is the old value, d k, plus an increment: If we chose i+ = i +: d d k dk ( dk dk k dk ) If we chose i+ = i : d k dk What is d (assuming integer endpoints)? Notice that we don t need c an more d

Bresenham s Algorithm For integers, slope between 0 and : =, =, d= d -d, draw (, ) until = =+ If d<0 then { =+, draw (, ), d=d- + } If d>0 then { =, draw (, ), d=d- } Compute the constants (- and ) once at the start Inner loop does onl adds and comparisons For floating point, initialization is harder, and will be floating point, but still no rounding required

Eample: (,) to (7,6) 7 6 5 =5, = d - 5 6 7 8 5

Eample: (,) to (7,6) 7 6 5 =5, = d - - 5 6 7 8 6

Eample: (,) to (7,6) 7 6 5 =5, = d - - 5 6 7 8 7

Eample: (,) to (7,6) 7 6 5 =5, = d - - 5-7 5 6 7 8 8

Eample: (,) to (7,6) 7 6 5 =5, = d - - 5-7 6 5-5 5 6 7 8 9

Eample: (,) to (7,6) 7 6 5 =5, = d - - 5-7 6 5-5 7 6-5 6 7 8 0

Filling Triangles 7 6 5 5 6 7 8

Filling Triangles 7 6 5 5 6 7 8

Algorithm Decide which piels to fill (samples to use) to represent a triangle? Calculate the color for each piel?

Barcentric coordinates P0=(0, 0) P P P P 0 0,, P=(, ) P=(, )

Barcentric coordinates 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) ( ) (, ) ( ) (, ) ( ) (,, /,, /,, /, f f f f f f f f f

Rasterizing Triangle min =min( 0,, ), ma =ma( 0,, ) min =min( 0,, ), ma =ma( 0,, ) for = min to ma for = min to ma calculate,, and if 0,,and c c 0 c c draw (, ) with color c 6

Anti-Aliasing Recall: We can t sample and then accuratel reconstruct an image that is not band-limited Infinite Nquist frequenc Attempting to sample sharp edges gives jaggies, or stairstep lines Solution: Band-limit b filtering (pre-filtering) What sort of filter will give a band-limited result? In practice, difficult to do for graphics rendering 7

Alpha-based Anti-Aliasing Set the of a piel to simulate a thick line The piel gets the line color, but with <= This supports the correct drawing of primitives one on top of the other Draw back to front, and composite each primitive over the eisting image Onl some hidden surface removal algorithms support it 0 0 0 /8 0 / 0 0.9 /8 / 0.9/ 0 /8.9 / 0 0 0 /8 0 0 0 8

Calculating Consider a line as having thickness (all good drawing programs do this) Consider piels as little squares Set according to the proportion of the square covered b the line The sub-piel coverage interpretation of 0 0 0 /8 0 0 0 /.9 /8 0 /.9 / 0 /8.9 / 0 0 0 /8 0 0 0 9

Weighted Sampling Instead of using the proportion of the area covered b the line, use convolution to do the sampling Equivalent to filtering the line then point sampling the result Place the filter at each piel, and integrate product of piel and line Common filters are cones (like Bartlett) or Gaussians 0

Post-Filtering (Supersampling) Sample at a higher resolution than required for displa, and filter image down Eas to implement in hardware Tpical is sampling per piel, with simple averaging to get final What kind of filter? More advanced methods generate different samples (eg. not on regular grid) and filter properl Issues of which samples to take, and how to filter them

Net Time Hidden Surface Removal