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

Similar documents
CS Rasterization. Junqiao Zhao 赵君峤

From Ver(ces to Fragments: Rasteriza(on

Chapter - 2: Geometry and Line Generations

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

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

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

Rasterization: Geometric Primitives

Line Drawing. Foundations of Computer Graphics Torsten Möller

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

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

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

From 3D World to 2D Screen. Hendrik Speleers

COMP371 COMPUTER GRAPHICS

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

Line Drawing Week 6, Lecture 9

Computer Graphics. - Rasterization - Philipp Slusallek

Overview of Computer Graphics

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

Scan Conversion. Drawing Lines Drawing Circles

Computer Graphics. Lecture 2. Doç. Dr. Mehmet Gokturk

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

Display Technologies: CRTs Raster Displays

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

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

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

CPSC / Scan Conversion

1 Introduction to Graphics

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

Rendering. A simple X program to illustrate rendering

An Improved Algorithm for Scan-converting a Line

Chapter 8: Implementation- Clipping and Rasterization

Topic #1: Rasterization (Scan Conversion)

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

The Traditional Graphics Pipeline

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

CS 4300 Computer Graphics. Prof. Harriet Fell Fall 2012 Lecture 5 September 13, 2012

The Traditional Graphics Pipeline

GRAPHICS OUTPUT PRIMITIVES

UNIT -8 IMPLEMENTATION

Graphics (Output) Primitives. Chapters 3 & 4

Unit 2 Output Primitives and their Attributes

Computer Graphics Lecture Notes

Efficient Plotting Algorithm

Rendering. A simple X program to illustrate rendering

Computer Graphics D Graphics Algorithms

The Traditional Graphics Pipeline

UNIT 2 GRAPHIC PRIMITIVES

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

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

Raster Scan Displays. Framebuffer (Black and White)

Computer Graphics: Line Drawing Algorithms

CS6504 & Computer Graphics Unit I Page 1

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

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

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

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

EF432. Introduction to spagetti and meatballs

Chapter 3. Sukhwinder Singh

U.C. Berkeley, EECS, Computer Science TAKE HOME EXAM. Your Class Computer Account: DO NOT OPEN THIS INSIDE SODA HALL -- WAIT UNTIL YOU ARE ALONE!

CS 543: Computer Graphics. Rasterization

Output Primitives Lecture: 4. Lecture 4

Institutionen för systemteknik

Scan Converting Lines

Department of Computer Science Engineering, Mits - Jadan, Pali, Rajasthan, India

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

Topic 0. Introduction: What Is Computer Graphics? CSC 418/2504: Computer Graphics EF432. Today s Topics. What is Computer Graphics?

Einführung in Visual Computing

SAZ4C COMPUTER GRAPHICS. Unit : 1-5. SAZ4C Computer Graphics

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

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

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

EF432. Introduction to spagetti and meatballs

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

(Refer Slide Time: 9:36)

CSCI 4620/8626. Coordinate Reference Frames

SRM UNIVERSITY FACULTY OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF COMPUTER APPLICATIONS COURSE PLAN

MODULE - 4. e-pg Pathshala

OXFORD ENGINEERING COLLEGE (NAAC Accredited with B Grade) DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING LIST OF QUESTIONS

Scan Conversion. Lines and Circles

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

Pipeline implementation II

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

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

Realtime 3D Computer Graphics Virtual Reality

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

U.C. Berkeley, EECS, Computer Science TAKE HOME EXAM. Your Class Computer Account: Your student ID #:

03 Vector Graphics. Multimedia Systems. 2D and 3D Graphics, Transformations

(Refer Slide Time: 00:02:00)

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

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

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

CS 130. Scan Conversion. Raster Graphics

A New Line Drawing Algorithm Based on Sample Rate Conversion

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

1. (10 pts) Order the following three images by how much memory they occupy:

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

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

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Transcription:

ECM2410:GraphicsandAnimation R asterisation Part I: Simple Lines Rasterisation 1/16 Rendering a scene User space Device space Affine transformation Compose Transform Render Com pose from primitives (lines, ellipses, etc) in user space. Transform affine transformations: lines lines; ellipses ellipses Render primitives on device. Rasterisation Line Rasterisation 2/16 Rasterisation Vector displays Pen plotters Tektronix cathode ray tubes Raster displays Monitors Televisions Laser, ink-jet, dot matrix printers Liquid crystal displays Arrays of LEDs Rasterisation is the conversion of ideal, mathematical graphics primitives onto raster displays. Drawing lines Drawing circles and ellipses Filling areas Hearn & Baker, Chapter 2 for displays. Rasterisation Line Rasterisation 3/16

Fram ebuffer Raster display is a 2D array of picture elements: pixels Framebuffer: in-memory image of the display. 2 1 0 0 1 2 Screen coordinates of pixels are centered at the integers. Pixels are individually set or cleared (random access). Sequential readout by physical device. Graphical objects are continuous. Framebuffer is discrete. Rasterisation / Framebuffer Line Rasterisation 4/16 Rasterisation Rasterisation is the conversion of ideal, mathematical graphics primitives onto raster displays. Efficiency we seek efficient algorithms for computing the discrete approximation to continuous description. Scan Conversion rasterisation line by line of the raster display. Rasterisation / Framebuffer Line Rasterisation 5/16 Line Segm ents Problem: Draw a line from (X start, Y start ) to (X end, Y end ) Simplified: Draw a line from (0, 0) to (X end, Y end ) (X end > 0 and Y end > 0) (19,4) (0,0) Grid marks pixel centres Example: Line from (0, 0) to (X end, Y end ) = (19, 4) Lines Line Rasterisation 6/16

Whichpixelstoilluminate? Illuminate every pixel the line intersects Illuminate the pixel Lines / Which Pixel? Line Rasterisation 7/16 Gradient Gradient of line y = m x + c m = Y end Y start X end X start Simplified line from (0, 0) to (X end, Y end ): Lines / Gradient Line Rasterisation 8/16 NaïveMidpointAlgorithm Illuminate pixel vertically closest to the line 4/19 12/19 8/19 16/19 double m = Yend / Xend; double y = 0.0; while ( x <= Xend ) { y = m * x; iy = round(y); DDA Digital Differential Analyser. Hearn & Baker, p86. Lines / Naïve Algorithm Line Rasterisation 9/16

Rem ove round() Line coherence: As x x + 1 then y y + m 4/19 8/19 12/19 16/19 At each step: move right one pixel and up by 4 19. midpoint indicates pixel centre above illuminated pixel. When y crosses vertical midpoint between two centres move up and compute new midpoint target. double m = Yend / Xend; int iy = 0; double y = 0.0; double midpoint = 0.5; while (x <= Xend) { y += m; if (y > midpoint) { Lines / Eliminating Floats Line Rasterisation 10/16 Integers only m = Y end X end y = m x = Y end x X end Multiply m, y and midpoint by twice total change in x; (i.e. ) m = 2 Y end y=8 16 y = 2 Y end x 24 32 int m = 2 * Yend; int iy = 0; int y = 0; int midpoint = Xend; while (x <= Xend) { y += m; if (y > midpoint) { iy++; midpoint += 2 * Xend; 19 midpoint 19 19 57 57 Lines / Eliminating Floats Line Rasterisation 11/16 Bresenham s algorithm Eliminate midpoint by adjusting y to start at the midpoint and decreasing to 0. y=19 11 3 5 => 33 Hearn & Baker, page 88 25 int m = 2 * Yend; int iy = 0; int y = Xend; while (x <= Xend) { y -= m; if (y < 0) { iy++; y += 2 * Xend; Lines / Bresenham s Algorithm Line Rasterisation 12/16

Caveats Needsadjustmentfor: References Lines with different slope may have different brightness. Alleviated with anti-aliasing (give pixels different brightness). Hearn & Baker, pp. 84-94 Foley & van Dam Lines / Bresenham s Algorithm Line Rasterisation 13/16 Bresenham Circle A lgorithm Choose pixel with centre closest to circle. Work on a single octant and draw others by symmetry. Can be written in integer arithmetic. Details in Hearn & Baker, Foley et al. Lines / Bresenham Circle Algorithm Line Rasterisation 14/16 ThickPrimitives Colum n Replication Efficient, easily implemented. Perceived thickness varies with slope. Gaps at joins. Rectangular Pen Ends are thicker than middle. Perceived thickness varies with slope. Pixels are set multiple times. Lines / Thick Primitives Line Rasterisation 15/16

ThickPrimitives Circular Pen Thickness independent of slope. Pixels are set multiple times. Can be made efficient by setting only boundary pixels. Lines / Thick Primitives Line Rasterisation 16/16