Download presentation
Presentation is loading. Please wait.
1
Joshua Barczak CMSC435 UMBC
Antialiasing Joshua Barczak CMSC435 UMBC *Some material borrowed from Dr. Olano (without asking)
2
Joshua Barczak CMSC435 UMBC
PIXELS SUCK! Joshua Barczak CMSC435 UMBC This slide NOT borrowed from Dr. Olano (if you’re offended, its all my fault)
3
Why Pixels Suck Original Scene Luminosity
4
Why Pixels Suck Pixel Sampling Samples 4
5
Why Pixels Suck Displayed Image Luminosity 5
6
Why Pixels Suck Jaggy Lines 6
7
Why Pixels Suck Jaggy Edges 7
8
Why Pixels Suck Missed Detail
9
Strobing/Popping 9
10
Frequency Aliasing
11
Aliasing Pixels cause a wide range of visual errors Jagged edges
Missed detail Strobing and popping Frequency aliasing All collectively called “aliasing” Though that’s somewhat incorrect…
12
Adding More… Reference Image.
13
Adding More… 2x Resolution (Cropped)
Problem #1: They stop fitting on the slide…
14
Adding More… 4x Resolution (Cropped)
Problem #2: It doesn’t solve the underlying problem… The pixels themselves are the problem, not the lack thereof…
15
Image Blurring Simplest Blur: Smear away the problem…
Average over NxN pixel neighborhood Smear away the problem…
16
Blurring the Image? Reference Image.
17
Blurring the Image? 3x3 Blur
18
Blurring the Image? 5x5 Blur
19
Blurring the Image? 7x7 Blur Now its too blurry…
20
Super-Sampling 3/9 Multiple “sub-samples” per pixel Estimates fraction of pixel covered by edge
21
Super-Sampling 6/16 6/16 6/16 Adding more samples gets us closer (4x4) 0.375
22
Super-Sampling 10/25 10/25 10/25 Adding more samples gets us closer (5x5) 0.4
23
Super-Sampling 15/36 15/36 15/36 Adding more samples gets us closer (6x6) 0.41
24
Super-Sampling 21/49 21/49 21/49 Adding more samples gets us closer (7x7) 0.42 Albeit painfully slowly…
25
Super-Sampling Adding more samples gets us closer (128x128) 0.496
8128/16384 8128/16384 8128/16384 Adding more samples gets us closer (128x128) 0.496
26
Original
27
3x3 SuperSample
28
7x7 SuperSample
29
Adaptive Super-Sampling
Super-sample pixels which differ sharply from their neighbors Example: Max absolute difference in normalized RGB Thresholded at 0.1
30
Aliased
31
Adaptive
32
Sources of Aliasing Geometric Aliasing Shader Aliasing
Small primitives Edges Shader Aliasing Noisy textures Bumpy/Shiny
33
Multi-sampling (MSAA)
SuperSampling Multi-Sampling Interpolate and shade at centroid of covered samples, store same result at each sample Interpolate and shade 3 times, store 3 results Geometric Geometric Shader Shader More on this later…
34
Analytic Antialiasing: Lines
Draw band of pixels straddling line Weight pixels by distance to line Wikipedia
35
Analytic Antialiasing: Polygons
Compute exact area of overlap region, weight accordingly Complicated Not as effective as you think Stay tuned
36
Behold! Your Nemesis! The Infamous Oblique Checkerboard!
The worst possible case for antialiasing Every possible sampling problem all in one image
37
2x2 (4 SPP)
38
4x4 (16 SPP) What’s that?
39
Moiree Patterns Interference pattern due to misaligned grids
Regular grids are a terrible sampling pattern…
40
Irregular Sampling “Jitter” sample locations
Random offset within each cell Aliasing is replaced by noise Still wrong, but its less obviously wrong… Jittered Grid
41
4x4 Regular
42
4x4 Jittered
43
8x8 Jittered
44
16x16 Jittered
45
32x32 Jittered (1024 samples!) And the ringing still doesn’t stop…
What gives?
46
Why Pixels Suck Pixel Sampling Samples 46
47
Aliasing Undersampled: Reconstructed wave has lower frequency
48
Sampling Sampling a function multiplies by an “impulse train”
49
* Reconstruction Applying a filter reconstructs a continuous function
Original Better filter, better reconstruction…
50
Reconstruction Discrete convolution: Shifted Filter Kernel si xi
Weighted average of samples that overlap filter’s support g()
51
“A Pixel Is Not a Little Square”
It is a little shifted reconstruction filter convolved with a continuous 2D signal Sample within pixel Sample within support of reconstruction filter Averaging samples Box reconstruction filter g(x)=1 g(x)=0 X=-0.5 X=0.5
52
“A Pixel Is Not a Little Square”
It is a little shifted reconstruction filter convolved with a continuous 2D signal Sample within pixel Sample within support of reconstruction filter What if we used a different filter? g(x)=1 g(x)=0 X=-1 X=1 Yes, pixels overlap…
53
The Fourier Transform A periodic function can be represented as a weighted sum of an arbitrarily large number of cosine waves Frequency domain (weights): Spatial domain (signal):
54
Fourier Transform: Examples
High band limit These are called “frequency spectra” Low band limit X axis Frequency Y axis Scaling factor
55
Sampling Sampling does strange and terrible things to the frequency spectrum “Base” spectrum “Alias” spectrum
56
Nyquist-Shannon Sampling Theorem
A signal may be exactly reconstructed from samples if the sampling rate is more than twice the band limit Nyquist Limit
57
Aliasing Raise sample rate Shift Alias spectra Aliasing -Frequency
No Aliasing Nyquist limit Band limit Sampling rate
58
Guess the band limit… Why is a raven like a writing desk…?
59
Guess the band limit… “To infinity and beyond!”
60
Box filter Fourier Transform Oscillates into infinity (and beyond…)
“Leaking” alias spectra Base signal is nice and crisp…
61
Gaussian filter Fourier Transform Approaches zero very fast
“Leaking” alias spectra are imperceptibly small… Base signal gets blurred a bit…
62
32x32 Box Average pixel samples…
63
32x32 Gaussian Gaussian weighting (and overlap neighboring pixels)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.