Download Thick Primitives, Halftone Approximation and Anti-aliasing in Computer Graphics - Prof. Da and more Lab Reports Computer Graphics in PDF only on Docsity!
1
CS 430/
Computer Graphics I
Thick Primitives,
Halftone Approximation
Anti-aliasing
Week 6, Lecture 11 David Breen, William Regli and Maxim Peysakhov Geometric and Intelligent Computing Laboratory Department of Computer Science Drexel University http://gicl.cs.drexel.edu
2 Outline
- Drawing with Thick Primitives
- Halftone Approximation
- Anti-aliasing
4 Three Basic Methods
- Column Replication
- Trace brush outline across 1-pixel primitive
- Trace two copies, t apart, and fill in 1994 Foley/VanDam/Finer/Huges/Phillips ICG
5 Column(Row) Replication
- Idea: duplicate pixels in
- Columns, when -1 < slope < 1
- Rows, otherwise
- Thickness t is from primitive’s boundaries perpendicular to its tangent
- What happens for even t?
- Issues when lines meet at angles, when octants merge, brightness for sloped lines, etc. 1994 Foley/VanDam/Finer/Huges/Phillips ICG
7 Halftone Approximation
- Not all devices can display all colors
- e.g. GIF is only 256 colors
- Idea: With few available shades, produce illusion of many colors/shades?
- Technique: Halftone Approximation
- Example: How do we do greyscale with black-and-white monitors? Pics/Math courtesy of Dave Mount @ UMD-CP
8 Halftone Approximation
- Technique: Dithering
- Idea: create meta-pixels, grouping base pixels into 3x3s or 4x4s
- Example: a 2x2 dither matrix for grayscale Pics/Math courtesy of Dave Mount @ UMD-CP
10 Halftone Approximation: Error Diffusion Example #
- Problem: draw 1D line with 1/3 gray tone
- Pixel #1: round to black, 0… error 1/
- Pixel #2: value 1/3+1/3=2/3 , color white
- Pixel #3: value 1/3-1/3=0, color black
- Pixel #4: value 1/3+0= 1/3, color black
- Color sequence: 01001001001… Pics/Math courtesy of Dave Mount @ UMD-CP
11 Halftone Approximation: Error Diffusion Example # Draw 1/3 gray line
- Pixel: 1/3 1/3 1/3 1/3 1/3 1/3 1/3 1/
- Error: 0 1/3 -1/3 0 1/3 -1/3 0 1/
- FB: 0 1 0 0 1 0 0 1
- Color sequence: 01001001001… Pics/Math courtesy of Dave Mount @ UMD-CP
13
- Let be the shade of pixel
- To draw we round pixel to nearest shade and set
- Then, diffuse the errors throughout surrounding pixels, e.g. Halftone Approximation: Error Diffusion Example # Pics/Math courtesy of Dave Mount @ UMD-CP S[x + 1][y] += (7/16) err S[x - 1][y - 1] += (3/16) err S[x][y - 1] += (5/16) err S[x + 1][y - 1] += (1/16) err
14 Halftone Approximation: Error Diffusion Example # Pics courtesy of Dimitri Gusev @ Indiana
16 The Aliasing Problem
- General problem in Analog-to-Digital conversion - When sampling, one needs to sample at a higher frequency than the analog signal - Aliasing shows up as spurious low frequencies Example: Music CDs Sampled: 44Khz Max frequency: 22Khz 1993 ACM SIGGRAPH Education Slide Set
17 The Aliasing Problem
- General problem in Analog-to-Digital conversion - When sampling, one needs to sample at a higher frequency than the analog signal - Aliasing shows up as spurious low frequencies Example: Music CDs Sampled: 44Khz Max frequency: 22Khz 1993 ACM SIGGRAPH Education Slide Set
19 Aliasing in Computer Graphics
- Mathematical model of image: analog
- Screen: digital
- Result: visual effects, jaggies, lost textures and detail 1993 ACM SIGGRAPH Education Slide Set
20 Antialiasing in use…