Attributes of Graphics Primitives

Similar documents
Einführung in Visual Computing

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

Unit 2 Output Primitives and their Attributes

Graphics (Output) Primitives. Chapters 3 & 4

Aliasing and Antialiasing. ITCS 4120/ Aliasing and Antialiasing

Chapter 3. Sukhwinder Singh

CS 325 Computer Graphics

COMP371 COMPUTER GRAPHICS

Graphics Output Primitives

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

CS 543: Computer Graphics. Rasterization

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

UNIT 2 GRAPHIC PRIMITIVES

Text in OpenGL and Windows. Computer Graphics Attributes. Computer Graphics. Binghamton University. EngiNet. Thomas J. Watson

Agenda. Polygon Terminology Types of polygons Inside Test Polygon Filling Algorithms. Scan-Line Polygon Fill Algorithm Flood-Fill Algorithm

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

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

Chapter - 2: Geometry and Line Generations

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

2D Graphics Primitives II. Additional issues in scan converting lines. 1)Endpoint order. Want algorithms to draw the same pixels for each line

Scan Conversion. Drawing Lines Drawing Circles

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

? Which intermediate. Recall: Line drawing algorithm. Programmer specifies (x,y) of end pixels Need algorithm to determine pixels on line path

Scan Converting Text. Attributes of Output Primitives. CS 460/560 Computer Graphics. Binghamton University. EngiNet. Thomas J.

CS 4731/543: Computer Graphics Lecture 7 (Part I): Raster Graphics: Polygons & Antialiasing. Emmanuel Agu

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

CSCI 4620/8626. Computer Graphics Attributes of Graphics Primitives (Chapter 5)

Visible Surface Detection Methods

Pipeline implementation II

Computer Graphics Lecture Notes

Computer Graphics. - Rasterization - Philipp Slusallek

CS354 Computer Graphics Sampling and Aliasing

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

Theoretically Perfect Sensor

Rasterization: Geometric Primitives

Computer Graphics CS 543 Lecture 11 (Part 1) Polygon Filling & Antialiasing

Theoretically Perfect Sensor

1 Introduction to Graphics

Computer Graphics. Sampling Theory & Anti-Aliasing. Philipp Slusallek

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

CSCI 4620/8626. Primitives and Attributes

Raster Scan Displays. Framebuffer (Black and White)

Computer Graphics Geometry and Transform

CSC Computer Graphics

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

Scan line algorithm. Jacobs University Visualization and Computer Graphics Lab : Graphics and Visualization 272

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

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

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

Chapter 8: Implementation- Clipping and Rasterization

Topics. From vertices to fragments

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

Adobe Photoshop Sh S.K. Sublania and Sh. Naresh Chand

Computer graphics 2 Marks 1. Define Computer graphics.

CS6504 & Computer Graphics Unit I Page 1

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

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

Filled Area Primitives. CEng 477 Introduction to Computer Graphics METU, 2007

Prof. Feng Liu. Fall /25/2018

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

Topic #1: Rasterization (Scan Conversion)

Sampling, Aliasing, & Mipmaps

Scan Conversion of Polygons. Dr. Scott Schaefer

Werner Purgathofer

Line Drawing. Foundations of Computer Graphics Torsten Möller

Lecture 2 October 31, 2005

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

From Ver(ces to Fragments: Rasteriza(on

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

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

POLYGON FILLING ALGORITHM

Rendering. Basic Math Review. Rasterizing Lines and Polygons Hidden Surface Remove Multi-pass Rendering with Accumulation Buffers.

Advanced Ray Tracing

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

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

UNIVERSITY OF NEBRASKA AT OMAHA Computer Science 4620/8626 Computer Graphics Spring 2014 Homework Set 1 Suggested Answers

Computer Graphics Solved MCQs -Part 2 MCQs Questions

Output models Drawing Rasterization Color models

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

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

Computer Graphics 7 - Rasterisation

Computer Graphics. Texture Filtering & Sampling Theory. Hendrik Lensch. Computer Graphics WS07/08 Texturing

Sampling, Aliasing, & Mipmaps

Today. Acceleration Data Structures for Ray Tracing. Cool results from Assignment 2. Last Week: Questions? Schedule

CS Rasterization. Junqiao Zhao 赵君峤

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

Ray-tracing Acceleration. Acceleration Data Structures for Ray Tracing. Shadows. Shadows & Light Sources. Antialiasing Supersampling.

Minnesota Academic Standards for Mathematics 2007

Display Technologies: CRTs Raster Displays

Overview of Computer Graphics

Antialiasing with Line Samples

SE Mock Online Test 1-CG

Sampling and Monte-Carlo Integration

Creating Mathematical Illustrations

CS-184: Computer Graphics. Today. 2D Scan Conversion. Tuesday, October 7, Drawing Lines Drawing Curves Filled Polygons Filling Algorithms

CS-184: Computer Graphics

Computer Graphics Geometry and Transform

GRAPHICS OUTPUT PRIMITIVES

Computer Graphics - Week 6

Transcription:

ttributes for Graphics Output Primitives ttributes of Graphics Primitives in 2 points, lines polygons, circles, ellipses & other curves (also filled) characters in 3 triangles & other polygons anti-aliasing Werner Purgathofer / omputergraphik 1 1 Points and Line ttributes color type: solid, dashed, dotted, width, line caps, corners pen and brush options rea-ill ttributes (1) fill styles hollow, solid fill, pattern fill fill options edge type, width, color pattern specification through pattern tables tiling (reference point) 4 0 0 4 4 0 0 4 4 0 0 4 4 0 0 4 4 0 0 4 4 0 0 4 4 0 0 4 4 0 0 4 4 0 0 4 4 0 0 4 4 0 0 4 4 0 0 4 4 0 0 4 Werner Purgathofer / omputergraphik 1 2 Werner Purgathofer / omputergraphik 1 3 rea-ill ttributes (2) Polygon ill lgorithms combination of fill pattern with background colors soft fill combination of colors antialiasing at object borders simul. of semitransparent brushes example: linear soft-fill...foreground color...background color Werner Purgathofer / omputergraphik 1 4 pattern background and or xor replace P = t + (1 t) what is inside? scan-line fill method flood fill method interior, exterior for selfintersecting polygons? Werner Purgathofer / omputergraphik 1 5 1

Polygon ill lgorithms what is inside? scan-line fill method flood fill method Polygon ill lgorithms what is inside? scan-line fill method flood fill method interior pixels along a scan line passing through a polygon area Werner Purgathofer / omputergraphik 1 6 starting from a seed point fill until you reach a border Werner Purgathofer / omputergraphik 1 7 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 What is Inside?: Odd-ven Rule inside/outside switches at every edge straight line to the outside: even # edge intersections = outside odd # edge intersections = inside Werner Purgathofer / omputergraphik 1 8 Werner Purgathofer / omputergraphik 1 9 What is Inside?: Nonzero Winding Number Scan-Line ill: Sorted dge Table point is inside if polygon surrounds it straight line to the outside: same # edges up and down = outside different # edges up and down = inside y x 1/m y x 1/m y x 1/m y x 1/m The sorted edge table contains all polygon edges sorted by lowest y-value y max x start 1/m y x 1/m Werner Purgathofer / omputergraphik 1 10 Werner Purgathofer / omputergraphik 1 11 2

Scan-Line ill: Sorted dge Table Sorted dge Table sort all edges on smallest y-value edge entry: [max y-value, x-intercept, inverse slope] y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m active-edge list for each scan line contains all edges crossed by that scan line incremental update consecutive intersection pairs (spans) filled Werner Purgathofer / omputergraphik 1 12 Werner Purgathofer / omputergraphik 1 13 y x 1/m The sorted edge table contains all polygon edges sorted by lowest y-value y max x start 1/m y x 1/m Sorted dge Table / ctive dge List Sorted dge Table / ctive dge List y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m ctive dge List Werner Purgathofer / omputergraphik 1 14 When processing from bottom to top, keep a list of all active edges ctive dge List y x 1/m y x 1/m Werner Purgathofer / omputergraphik 1 15 incremental update! Sorted dge Table / ctive dge List Sorted dge Table / ctive dge List y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m ctive dge List ctive dge List y x 1/m y x 1/m y x 1/m Werner Purgathofer / omputergraphik 1 16 Werner Purgathofer / omputergraphik 1 17 3

Sorted dge Table / ctive dge List Sorted dge Table / ctive dge List y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m ctive dge List ctive dge List y x 1/m y x 1/m Werner Purgathofer / omputergraphik 1 18 Werner Purgathofer / omputergraphik 1 19 Sorted dge Table / ctive dge List Sorted dge Table / ctive dge List y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m ctive dge List ctive dge List y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m Werner Purgathofer / omputergraphik 1 20 Werner Purgathofer / omputergraphik 1 21 Sorted dge Table / ctive dge List Sorted dge Table / ctive dge List y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m ctive dge List ctive dge List y x 1/m y x 1/m Werner Purgathofer / omputergraphik 1 22 Werner Purgathofer / omputergraphik 1 23 4

Sorted dge Table / ctive dge List Sorted dge Table / ctive dge List y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m ctive dge List ctive dge List y x 1/m y x 1/m Werner Purgathofer / omputergraphik 1 24 Werner Purgathofer / omputergraphik 1 25 Sorted dge Table / ctive dge List y x 1/m y x 1/m y x 1/m y x 1/m y x 1/m ctive dge List Scan-Line ill: Incremental Update incremental update of intersection point slope of polygon boundary line: m x k+ = 1 x + k 1 m (for 2 successive scanlines) (x k+1, y k+1 ) (x k, y k ) y k = + 1 y 1 + k y k +1 y k Werner Purgathofer / omputergraphik 1 26 Werner Purgathofer / omputergraphik 1 27 Scan-Line ill: Intersecting Vertices intersection points along scan lines that intersect polygon vertices. 2 1 either special handling (1 or 2 intersections?) 2 2 1 lood-ill lgorithm 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 or move vertices up or down by ε Werner Purgathofer / omputergraphik 1 28 Werner Purgathofer / omputergraphik 1 29 5

lood-ill: oundary and Seed Point lood-ill: onnectedness area must be distinguishable from boundaries seed point example: area defined within multiple color boundaries efinition: 4-connected means, that a connection is only valid in these 4 directions efinition: 8-connected means, that a connection is valid in these 8 directions Werner Purgathofer / omputergraphik 1 30 Werner Purgathofer / omputergraphik 1 31 xamples for 4- and 8-connected a 4-connected area has an 8-connected border Werner Purgathofer / omputergraphik 1 32 an 8-connected area has a 4-connected border Simple lood-ill lgorithm void floodill4 (int x, int y, int new, int old) { int color; /* set current color to new */ getpixel (x, y, color); if (color = old) { setpixel (x, y); floodill4 (x 1, y, new, old); /* left */ floodill4 (x, y+1, new, old); /* up */ floodill4 (x+1, y, new, old); /* right */ floodill4 (x, y 1, new, old) /* down */ }} Werner Purgathofer / omputergraphik 1 33 ad ehavior of Simple lood-ill Span lood-ill lgorithm 1 2 4 3 recursion sequence floodill4 produces too high stacks (recursion!) solution: incremental horizontal fill (left to right) recursive vertical fill (first up then down) Werner Purgathofer / omputergraphik 1 34 Werner Purgathofer / omputergraphik 1 35 6

Good ehavior of Span lood-ill Span lood-ill xample 1 2 recursion sequence x Werner Purgathofer / omputergraphik 1 36 Werner Purgathofer / omputergraphik 1 37 Span lood-ill xample Span lood-ill xample 1 2 3 x 4 5 6 7 8 9 10 11 1 2 3 Werner Purgathofer / omputergraphik 1 38 Werner Purgathofer / omputergraphik 1 39 Span lood-ill xample Span lood-ill xample G 12 13 14 4 5 6 7 8 9 10 11 1 2 3 G 12 13 14 =H 4 5 6 7 8 9 10 11 1 2 3 G H Werner Purgathofer / omputergraphik 1 40 Werner Purgathofer / omputergraphik 1 41 7

Span lood-ill xample Span lood-ill xample () 4 5 6 7 8 9 10 11 1 2 3 H J 20 21 22 I 4 5 6 7 8 9 10 11 1 2 3 I J Werner Purgathofer / omputergraphik 1 42 Werner Purgathofer / omputergraphik 1 43 Span lood-ill xample Span lood-ill xample 20 21 22 1 2 3 I I J 20 21 22 1 2 3 24 25 K I K Werner Purgathofer / omputergraphik 1 44 Werner Purgathofer / omputergraphik 1 45 Span lood-ill xample Span lood-ill xample 20 21 22 1 2 3 24 25 =N 26 27 28 29 30 M L K L M N 20 21 22 1 2 3 () 24 25 31 32 33 26 27 28 29 30 M L L M N Werner Purgathofer / omputergraphik 1 46 Werner Purgathofer / omputergraphik 1 47 8

Span lood-ill xample Span lood-ill xample 20 21 22 1 2 3 24 25 31 32 33 26 27 28 29 30 34 35 L L M 20 21 22 1 2 3 24 25 31 32 33 26 27 28 29 30 34 35 36 37 L Werner Purgathofer / omputergraphik 1 48 Werner Purgathofer / omputergraphik 1 49 Span lood-ill xample 20 21 22 1 2 3 38 24 25 31 32 33 26 27 28 29 30 34 35 36 37 Werner Purgathofer / omputergraphik 1 50 finished! haracter ttributes text attributes font (e.g. ourier, rial, Times, Werner Purgathofer / omputergraphik 1 51, ) styles (regular, bold, italic, underline, ) size (32 point, 1 point = 1/72 inch) proportionally sized vs. fixed space fonts string attributes horizontal orientation alignment (left, center, right, justify) isplayed primitives generated by the raster algorithms discussed in hapter 3 have a jagged, or stairstep, appearance. isplayed primitives generated by the raster algorithms discussed in hapter 3 have a jagged, or stairstep, appearance. isplayed primitives generated by the raster algorithms discussed in hapter 3 have a jagged, or stairstep, appearance. slanted v e r t i c a l isplayed primitives generated by the raster algorithms discussed in hapter 3 have a jagged, or stairstep, appearance. Triangle and Polygon ttributes color material transparency texture surface details reflexion properties, liasing and ntialiasing what is aliasing? ['eiliæsiη] what is the reason for aliasing? what can we do against it? defined illumination produces effects Werner Purgathofer / omputergraphik 1 52 Werner Purgathofer / omputergraphik 1 53 9

What is liasing? liasing: Staircase ffect errors that are caused by the discretization of analog data to digital data Werner Purgathofer / omputergraphik 1 54 too bad resolution too few colors too few images / sec geometric errors numeric errors Werner Purgathofer / omputergraphik 1 55 Various liasing ffects liasing from too few olors artificial color borders can appear Werner Purgathofer / omputergraphik 1 56 Werner Purgathofer / omputergraphik 1 57 liasing in nimations jumping images "worming t Solutions against liasing? 1. improve the devices higher resolution more color levels faster image sequence expensive or incompatible backwards rotating wheels 2. improve the images = antialiasing postprocessing software prefiltering! Werner Purgathofer / omputergraphik 1 58 Werner Purgathofer / omputergraphik 1 59 10

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" Shannon Sampling Theorem original signal reconstructed signal sampling rate Δ Δ Nyquist sampling interval Werner Purgathofer / omputergraphik 1 60 Werner Purgathofer / omputergraphik 1 61 ntialiasing: Nyquist Sampling requency a signal can only be reconstructed without information loss if the sampling frequency is at least twice the highest frequency of the signal Nyquist sampling frequency: f s = 2 f max Δxcycle Δx = with Δx = s cycle 1/ fmax 2 i.e. sampling interval one-half cycle interval ntialiasing Strategies 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 Werner Purgathofer / omputergraphik 1 62 Werner Purgathofer / omputergraphik 1 63 ntialiasing: Supersampling Lines 0 0 1 0 2 2 3 1 0 0 0 4 1 6 8 8 5 0 ntialiasing mathematical line 3 = max. intensity... 0 = min. intensity line of finite width 9 = max. intensity... 0 = min. intensity Werner Purgathofer / omputergraphik 1 64 Werner Purgathofer / omputergraphik 1 65 11

ntialiasing: rea Sampling Lines ntialiasing: Pixel Weighting Masks calculate the pixel coverage exactly can be done with incremental schemes 0% 0% 43% 15% 71% 84% 90% 52% 3% more weight for center subpixels must be divided by sum of weights subpixel grids can also include some neighboring pixels relative weights for a grid of 3x3 subpixels Werner Purgathofer / omputergraphik 1 66 Werner Purgathofer / omputergraphik 1 67 ntialiasing: iltering Techniques continuous overlapping weighting functions to calculate the antialiased values with integrals box filter cone filter Gaussian filter Werner Purgathofer / omputergraphik 1 68 ntialiasing: Intensity ifferences Werner Purgathofer / omputergraphik 1 69 unequal line lengths displayed with the same number of pixels in each line/row have different intensities proper antialiasing compensates for that! ntialiasing ntialiasing rea oundaries (1) alternative 1: supersampling adjusting pixel intensities along an area boundary Werner Purgathofer / omputergraphik 1 70 Werner Purgathofer / omputergraphik 1 71 12

ntialiasing rea oundaries (2) alternative 2: like midpoint line algorithm p = y y mid = [m(x k + 1) + b] (y k + 0.5) y ymid Werner Purgathofer / omputergraphik 1 72 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] ) ntialiasing rea oundaries (3) p = p +(1-m) = [m(x k + 1) + b] (y k + 0.5) + (1 m) = = mx k + b y k + 0.5 = mx k + b (y k 0.5) y k p for next pixel = overlap area for current pixel p y k + 0.5 x k x k +1 Werner Purgathofer / omputergraphik 1 73 p p m 1-m 1-m m ntialiasing rea oundaries (4) ntialiasing xamples Werner Purgathofer / omputergraphik 1 74 Werner Purgathofer / omputergraphik 1 75 ntialiasing xamples Summary: ttributes of Primitives in 2 points, lines polygons, circles, ellipses & other curves (also filled) characters in 3 triangles & other polygons anti-aliasing Werner Purgathofer / omputergraphik 1 76 Werner Purgathofer / omputergraphik 1 77 13