CST 494/598 Computer Graphics Anshuman Razdan i3dea.asu.edu/razdan.

Slides:



Advertisements
Similar presentations
CHAPTER 3 2D GRAPHICS ALGORITHMS
Advertisements

Chapter 3 Drawing and Composing an Illustration. Objectives Draw straight lines Draw curved lines Draw elements of an illustration Apply attributes to.
CS 551 / CS 645 Antialiasing. What is a pixel? A pixel is not… –A box –A disk –A teeny tiny little light A pixel is a point –It has no dimension –It occupies.
© 2001 By Default! A Free sample background from Slide 1 Attributes of Output Primitives Definition Parameter that affects.
Different types of Polygons Simple Convex Simple Concave Non-simple : self-intersecting With holes ConvexConcaveSelf-intersecting.
CS 376 Introduction to Computer Graphics 02 / 05 / 2007 Instructor: Michael Eckmann.
Implementation Dr. Amy Zhang. Reading 2  Hill, Chapters  Hill, Chapter 10.
CMPE 466 COMPUTER GRAPHICS
Implementation III Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
CS248 Midterm Review. CS248 Midterm Mon, November 3, 7-9 pm, Gates B01 Mostly “short answer” questions – Keep your answers short and sweet! Covers lectures.
CS 454 Computer graphics Polygon Filling
Graphics Output Primitives Pixel Addressing and Fill Area Dr. M. Al-Mulhem Feb. 1, 2008.
CS248 Midterm Review Michael Green and Sean Walker (based on the work of previous TAs)
CS 4731: Computer Graphics Lecture 22: Raster Graphics Part 3 Emmanuel Agu.
Aliasing and Anti-Aliasing Copyright Zachary Wartell, University of North Carolina at Charlotte, All Rights Reserved Revision: 10/24/2007 3:38:00 AM ©Zachary.
Computer Graphics, KKU. Lecture 9
TOPIC 4 PART III FILL AREA PRIMITIVES POLYGON FILL AREAS CGMB214: Introduction to Computer Graphics.
1 CSCE 441: Computer Graphics Scan Conversion of Polygons Jinxiang Chai.
March Shape Drawing Algorithms Shmuel Wimer Bar Ilan Univ., Engineering Faculty.
CGMB 314 Intro to Computer Graphics Fill Area Primitives.
1/24/20061 Fill-Area Algorithms and Functions. 1/24/20062 Learning Objectives OpenGL state variables Color and gray scale Color functions Point attributes.
Geometric Objects Computer Graphics Lab. Sun-Jeong Kim.
CGMB214: Introduction to Computer Graphics
Dr. S.M. Malaek Assistant: M. Younesi
3/4/04© University of Wisconsin, CS559 Spring 2004 Last Time Clipping Lines –Cohen-Sutherland: The use of outcodes and early reject/accept tests –Liang-Barsky:
Graphics Graphics Korea University cgvr.korea.ac.kr Raster Graphics 고려대학교 컴퓨터 그래픽스 연구실.
Introduction to Computer Graphics with WebGL
CS 480/680 Computer Graphics Implementation III Dr. Frederick C Harris, Jr. Fall 2011.
10/26/04© University of Wisconsin, CS559 Fall 2004 Last Time Drawing lines Polygon fill rules Midterm Oct 28.
1 Introduction Line attribute Color and gray scale Area filled attribute Anti-aliasing.
CS 450: COMPUTER GRAPHICS ANTIALIASING SPRING 2015 DR. MICHAEL J. REALE.
CSE 494/598 Intro to Applied Computer Graphics Anshuman Razdan DCST AR's Web Page AR's Web Page
INT 840E Computer graphics Introduction & Graphic’s Architecture.
2D Output Primitives Points Lines Circles Ellipses Other curves Filling areas Text Patterns Polymarkers.
Image Processing Basics. What are images? An image is a 2-d rectilinear array of pixels.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Aliasing & Anti-Aliasing. 2 What is aliasing? An artifact (loss of detail and false details) Caused by discretization (finite resolution) A rasterized.
Sang Il Park Sejong University
DIGITAL IMAGE. Basic Image Concepts An image is a spatial representation of an object An image can be thought of as a function with resulting values of.
Duy & Piotr. How to reconstruct a high quality image with the least amount of samples per pixel the least amount of resources And preserving the image.
Attributes of Graphics Primitives Hearn & Baker Chapter 4 Some slides are taken from Robert Thomsons notes.
Computer Graphics Filling. Filling Polygons So we can figure out how to draw lines and circles How do we go about drawing polygons? We use an incremental.
2D Output Primitives Points Lines Circles Ellipses Other curves Filling areas Text Patterns Polymarkers.
Lecture 15: Raster Graphics and Scan Conversion
1 CSCE 441: Computer Graphics Scan Conversion of Polygons Jinxiang Chai.
CS552: Computer Graphics Lecture 17: Scan Conversion (Special Cases)
Rasterization Overview Raster Display Device. Scan Conversion / Rasterization: converting vector graphics into raster graphics (determining pixels in.
Computer Graphics CC416 Week 14 Filling Algorithms.
Attributes of Graphics Primitives Chapter 4
Computer Graphics Lecture 08 Taqdees A. Siddiqi Computer Graphics Filled Area Primitives I Lecture 08 Taqdees A. Siddiqi
Computer Graphics CC416 Lecture 04: Bresenham Line Algorithm & Mid-point circle algorithm Dr. Manal Helal – Fall 2014.
ATTRIBUTE OF OUTPUT PRIMITIVES. Attribute of Output Primitives 30/9/2008 A.Aruna/Assistant professor/IT/SNSCE 2 Definition Line Attribute Curve Attribute.
Antialiasing. What is alias? Alias - A false signal in telecommunication links from beats between signal frequency and sampling frequency (from dictionary.com)
Computer Graphics I, Fall 2010 Scan conversion algorithms.
OUTPUT PRIMITIVES CEng 477 Computer Graphics METU, 2004.
CS552: Computer Graphics Lecture 16: Polygon Filling.
Pattern filling in scan-conversion Antialiasing
Attributes of Graphics Primitives Hearn & Baker Chapter 4
Introduction to Polygons
Polygons.
Computer Graphics Filled Area Primitives II Lecture 09 Taqdees A
Implementation III.
Introduction to Computer Graphics with WebGL
Prof. Harriet Fell Fall 2011 Lecture 9 – September 26, 2011
Computer Graphics Implementation III
Primitive Drawing Algorithm
NOTE.
Primitive Drawing Algorithm
Implementation III Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

CST 494/598 Computer Graphics Anshuman Razdan i3dea.asu.edu/razdan

A Razdan and Peter Wonka 1 Disclaimer These slides can only be used as study material for the class 470 at ASU The slides cannot be distributed or used for another purpose The slides may contain errors The slides do not contain all the information necessary to succeed in class; additional material from the book must to be studied The slides are based on a lecture from Prof. Purgathofer from the Vienna University of Technology

A Razdan and Peter Wonka 3 Color and Gray Scale color information: RGB color codes directly in frame buffer 1024 x 1024 x 24 bit/color  3 Mbyte storage color (lookup) tables less storage easy change of color table (e.g., for color coding) gray scale calculated from RGB e.g. intensity = 0.5 [min(r,g,b) + max(r,g,b)] red green blue Farbe black blue green cyan red magenta yellow yellow white

A Razdan and Peter Wonka 4 Color Lookup Table i j r i j g i j b i j xx xx r g b instead of: now: selected colors addressed by table index

A Razdan and Peter Wonka 5 Line Attributes (1) type solid, dashed, dotted,… pixel mask (raster line algorithms) width Bresenham + additional vertical (horizontal) spans width dependent on line slope line caps

A Razdan and Peter Wonka 6 Line Attributes (2) width thick lines as filled rectangles joining two segments: miter round bevel pen and brush options shape, size, pattern pixel mask simulation of brush strokes color

A Razdan and Peter Wonka 7 Area-Fill Attributes (1) fill styles hollow with color border filled with solid color filled with specific pattern or design (e.g., hatch,…)

A Razdan and Peter Wonka 8 Area-Fill Attributes (2) fill options edge type, width, color pattern specification through pattern tables tiling (pattern reference point) start position pixel start position

A Razdan and Peter Wonka 9 Area-Fill Attributes (3) combination of fill pattern with background colors soft fill combination of colors antialiasing at object borders simulation of semitransparent brushes example: linear soft-fill pattern back- ground and or xor replace F...foreground color B...background color BttFtFP)1( 

A Razdan and Peter Wonka 10 Scan-Line Polygon-Fill Algorithm interior pixels along a scan line passing through a polygon area

A Razdan and Peter Wonka 11 Scan-L. Fill: Intersecting Vertices intersection points along scan lines that intersect poly- gon vertices. y: odd number of intersections y’: even number of intersections (bad) can be paired for correct interior pixel spans

A Razdan and Peter Wonka 12 Scan-L. Fill: Incremental Update incremental update of intersection point kk kk xx yy m        kk yy m xx kk 1 1    y x xx kk     1 slope of polygon boundary line: m (for 2 successive scanlines)

A Razdan and Peter Wonka 13 Scan-L. Fill: Sorted Edge Table sort all edges on smallest y-value edge entry: [max y-value, x-intercept, inverse slope] active-edge list for each scan line contains all edges crossed by that scan line incremental update consecutive intersection pairs (spans) filled

A Razdan and Peter Wonka 14 Sorted Edge Table: Example a polygon and its sorted edge table, with edge DC shortened by 1 unit

A Razdan and Peter Wonka 15 Scan-Line Fill: Active-Edge List active-edge list for - DC’ - DE - AE - AB

A Razdan and Peter Wonka 16 Inside-Outside Tests area-filling algorithms “interior”, “exterior” for self-intersecting polygons? odd-even rule nonzero winding number rule cross or dot product to determine winding number same result for simple polygons

A Razdan and Peter Wonka 17 Flood-Fill Algorithm pixel filling of area areas with no single color boundary start from interior point “flood” internal region 4-connected, 8-connected areas reduce stack size by eliminating several recursive calls

A Razdan and Peter Wonka 18 Flood-Fill: Definition of Boundary area must be distinguishable from boundaries example: area defined within multiple color boundaries

A Razdan and Peter Wonka 19 Flood-Fill: Connectedness Definition: 4-connected means, that a connection is only valid in these 4 directions Definition: 8-connected means, that a connection is only valid in these 8 directions

A Razdan and Peter Wonka 20 Example for 4- and 8-connected a 4-connected areaan 8-connected area a 4-connected area has an 8-connected border an 8-connected area has a 4-connected border

A Razdan and Peter Wonka 21 Simple Flood-Fill Algorithm

A Razdan and Peter Wonka 22 Bad Behaviour of Simple Flood-Fill recursion sequence

A Razdan and Peter Wonka 23 Span Flood-Fill Algorithm floodFill4 produces too high stacks (recursion!) solution: incremental horizontal fill (left to right) recursive vertical fill (first up then down)

A Razdan and Peter Wonka 24 Good Behaviour of Span Flood-Fill 1 2 recursion sequence

A Razdan and Peter Wonka 25 Span Flood-Fill Example x

A Razdan and Peter Wonka 26 Span Flood-Fill Example s2 123 s1

A Razdan and Peter Wonka 27 Span Flood-Fill Example s5s s2 s1 s3

A Razdan and Peter Wonka 28 Span Flood-Fill Example s s s3 123 s2 s1

A Razdan and Peter Wonka 29 Span Flood-Fill Example s s3 123 s2 s

A Razdan and Peter Wonka 30 Span Flood-Fill Example s3 123 s2 s1

A Razdan and Peter Wonka 31 Span Flood-Fill Example s s2 s3s

A Razdan and Peter Wonka 32 Span Flood-Fill Example s2 s3s

A Razdan and Peter Wonka 33 Span Flood-Fill Example s s1 s

A Razdan and Peter Wonka 34 Span Flood-Fill Example s s1=s s4s

A Razdan and Peter Wonka 35 Span Flood-Fill Example s s4s

A Razdan and Peter Wonka 36 Span Flood-Fill Example s s

A Razdan and Peter Wonka 37 Span Flood-Fill Example s

A Razdan and Peter Wonka 38 Span Flood-Fill Example

A Razdan and Peter Wonka 39 text attributes font (e.g. Courier, Arial, Times, Roman, …) styles (regular, bold, italic, underline,…) size (32 point, 1 point = 1/72 inch) proportionally sized vs. fixed space fonts string attributes orientation alignment (left, center, right, justify) Character Attributes verticalvertical horizontal slanted Displayed primitives generated by the raster algorithms discussed in Chapter 3 have a jagged, or stairstep, appearance.

A Razdan and Peter Wonka 40 Antialiasing what is aliasing? what is the reason for aliasing? what can we do against it?

A Razdan and Peter Wonka 41 What is Aliasing? not enough resolution not enough colors not enough images / sec geometric errors numeric errors errors that are caused by the discretization of analog data to digital data

A Razdan and Peter Wonka 42 Aliasing: Staircase Effect

A Razdan and Peter Wonka 43 Various Aliasing Effects

A Razdan and Peter Wonka 44 Aliasing from too few Colors artificial color borders can appear

A Razdan and Peter Wonka 45 Aliasing in Animations jumping images "worming“ backwards rotating wheels

A Razdan and Peter Wonka 46 Backwards Rotating Wheels

A Razdan and Peter Wonka 47 Solutions against Aliasing? 1. improve the devices higher resolution more color levels faster image sequence 2. improve the images postprocessing antialiasing ! expensive or incompatible software

A Razdan and Peter Wonka 48 Shannon Sampling Theorem a signal can only be reconstructed without information loss if the sampling frequency is at least twice the highest frequency of the signal this border frequency is called "Nyquist Limit"

A Razdan and Peter Wonka 49 Shannon Sampling Theorem Nyquist sampling interval sampling rate  original signal reconstructed signal 

A Razdan and Peter Wonka 50 Antialiasing: Nyquist Sampling Frequency a signal can only be reconstructed without information loss if the sampling frequency is at least twice the highest frequency of the signal maxcycle /1x with 2 f x x cycle s    i.e. sampling interval  one-half cycle interval max 2ff s  Nyquist sampling frequency:

A Razdan and Peter Wonka 51 supersampling straight-line segments subpixel weighting masks area sampling straight-line segments filtering techniques compensating for line-intensity differences antialiasing area boundaries (adjusting boundary pixel positions) adjusting boundary pixel intensity Antialiasing Strategies

A Razdan and Peter Wonka 52 Antialiasing: Supersampling Lines = max. intensity... 0 = min. intensity 9 = max. intensity... 0 = min. intensity thin line line of finite width

A Razdan and Peter Wonka 53 Antialiasing

A Razdan and Peter Wonka 54 Antialiasing: Area Sampling Lines calculate the pixel coverage exactly can be done with incremental schemes 0%0%0%0% 0%0%0%0% %3%3%3%

A Razdan and Peter Wonka 55 Antialiasing: Pixel Weighting Masks relative weights for a grid of 3x3 subpixels more weight for center subpixels must be divided by sum of weights subpixel grids can also include some neighboring pixels

A Razdan and Peter Wonka 56 Antialiasing: Filtering Techniques box filter cone filter Gaussian filter continuous overlapping weighting functions to calculate the antialiased values with integrals

A Razdan and Peter Wonka 57 Antialiasing: Compensating for Intensity Differences unequal line lengths displayed with the same number of pixels in each line/row have different intensities proper antialiasing compensates for that!

A Razdan and Peter Wonka 58 Antialiasing

A Razdan and Peter Wonka 59 Antialiasing Area Boundaries (1) adjusting pixel intensities along an area boundary alternative 1: supersampling

A Razdan and Peter Wonka 60 Antialiasing Area Boundaries (2) alternative 2: like midpoint line algorithm p´ = y  y mid = [m(x k + 1) + b]  (y k + 0.5) p´<0  y closer to y k p´>0  y closer to y k+1 p = p´+ (1  m) : p<1  m  closer to y k p>1  m  closer to y k+1 ( and p  [0,1] ) y y mid Note: We add (1-m) so that the decision parameter p = area covered by polygon!

A Razdan and Peter Wonka 61 Antialiasing Area Boundaries (3) p = p´+(1-m) = [m(x k + 1) + b]  (y k + 0.5) + (1  m) = mx k + b  y k = xkxk x k +1 ykyk y k p for next pixel = overlap area for current pixel p´ p = p´-m+1 = p´+(1-m) m p´-m

A Razdan and Peter Wonka 62 Antialiasing Examples

A Razdan and Peter Wonka 63 Antialiasing Examples

A Razdan and Peter Wonka 64 Summary: Attributes of Primitives color and greyscale line attributes area fill attributes character attributes antialiasing aliasing effects reasons for aliasing antialiasing strategies