cmsc 491/635

28
Sampling and Antialiasing CMSC 491/635

Upload: aglaia

Post on 24-Feb-2016

69 views

Category:

Documents


0 download

DESCRIPTION

CMSC 491/635. Sampling and Antialiasing. Abstract Vector Spaces. Addition C = A + B = B + A (A + B) + C = A + (B + C) given A, B, A + X = B for only one X Scalar multiply C = a A a (A + B) = a A + a B (a+b) A = a A + b A. Abstract Vector Spaces. Inner or Dot Product - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CMSC  491/635

Sampling and Antialiasing

CMSC 491/635

Page 2: CMSC  491/635

Abstract Vector Spaces

• Addition– C = A + B = B + A– (A + B) + C = A + (B + C)– given A, B, A + X = B for only one X

• Scalar multiply– C = a A– a (A + B) = a A + a B– (a+b) A = a A + b A

Page 3: CMSC  491/635

Abstract Vector Spaces

• Inner or Dot Product– b = a (A • B) = a A • B = A • a B– A • A ≥ 0; A • A = 0 iff A = 0– A • B = (B • A)*

Page 4: CMSC  491/635

Vectors and Discrete Functions

Vector Discrete Function

V = (1, 2, 4) V[I] = {1, 2, 4}

a V + b U a V[I] + b U[I]

V • U ∑ (V[I] U*[I])

Page 5: CMSC  491/635

Vectors and Discrete Functions

• 2t in terms of t0, t1, t2 = [1,.5,.5]

2t

1 t t2

Page 6: CMSC  491/635

Vectors and Discrete Functions

• 2t in terms of t0, t0.5, t1, t1.5, t2

2t

1 t0.5 t t1.5 t2

Page 7: CMSC  491/635

Vectors and Functions

Vector Discrete Continuous

V V[I] V(x)

a V + b U a V[I] + b U[I] a V(x) + b U(x)

V • U ∑ V[I] U*[I] ∫ V(x) U*(x) dx

Page 8: CMSC  491/635

Vectors and Functions

• 2t projected onto 1, t, t2

2t

1 t t2

Page 9: CMSC  491/635

Function Bases

• Time: d(t)• Polynomial / Power Series: tn

• Discrete Fourier: ei π t K/N / √2N– K, N integers– t, K [-N, N]– (where eiq = cos q + i sin q)

• Continuous Fourier: ei w t / √2π

Page 10: CMSC  491/635

Fourier Transforms

Discrete Time

ContinuousTime

DiscreteFrequency

Discrete Fourier Transform

Fourier Series

ContinuousFrequency

Discrete-time Fourier Transform

Fourier Transform

Page 11: CMSC  491/635

Convolution

• f(t) g(t) F(w) * G(w)• g(t) * f(t) F(w) G(w)• Where f(t) * g(t) = ∫ f(s) g(t-s) ds

– Dot product with shifted kernel

Page 12: CMSC  491/635

Filtering

• Filter in frequency domain– FT signal to frequency domain– Multiply signal & filter– FT signal back to time domain

• Filter in time domain– FT filter to time domain– Convolve signal & filter

Page 13: CMSC  491/635

Sampling

• Multiply signal by pulse train

Page 14: CMSC  491/635

Aliasing

• High frequencies alias as low frequencies

Page 15: CMSC  491/635

Aliasing in images

Page 16: CMSC  491/635

Antialiasing

• Blur away frequencies that would alias

• Blur preferable to aliasing• Filter kernel size

– IIR = infinite impulse response– FIR = finite impulse response

• Windowed filters

Page 17: CMSC  491/635

“Ideal”

• Low pass filter eliminates all high freq– box in frequency domain– sinc in spatial domain (sin x / x)– Possible negative results– Infinite kernel

• Exact reconstruction to Nyquist limit– Sample frequency ≥ 2x highest frequency– Exact only if reconstructing with ideal low-

pass filter (=sinc)

Page 18: CMSC  491/635

Reconstruction

• Convolve samples & reconstruction filter

• Sum weighted kernel functions

Page 19: CMSC  491/635

Ideal Continuous Image

Filtering & Reconstruction

Sample

Reconstruction Filter

Sampled Image Pixels

Continuous Display

Page 20: CMSC  491/635

Filtered Continuous Image

Ideal Continuous Image

Sampled Image Pixels

Filtering, Sampling, Reconstruction

Continuous Display

Filter

Sample

Reconstruction Filter

Page 21: CMSC  491/635

Combine Filter & Sample

• Can combine filter and sample– Evaluate convolution at samples

Ideal Continuous Image

Sampled Image Pixels

Continuous Display

Sampling Filter

Reconstruction Filter

Page 22: CMSC  491/635

Analytic Area Sampling

• Compute “area” of pixel covered• Box in spatial domain

– Nice finite kernel• easy to compute

– sinc in freq domain• Plenty of high freq• still aliases

Page 23: CMSC  491/635

Analytic higher order filtering

• Fold better filter into rasterization– Can make rasterization much harder– Usually just done for lines

• Draw with filter kernel “paintbrush”

• Only practical for finite filters

Page 24: CMSC  491/635

Supersampling

• Numeric integration of filter• Grid with equal weight = box filter• Push up Nyquist

frequency– Edges: ∞ frequency,

still alias• Other filters:

– Grid with unequal weights

– Priority sampling

Page 25: CMSC  491/635

Adaptive sampling

• Vary numerical integration step• More samples in

high contrast areas• Easy with ray

tracing, harder for others

• Possible bias

Page 26: CMSC  491/635

Stochastic sampling

• Monte-Carlo integration of filter• Sample distribution

– Poisson disk– Jittered grid

• Aliasing Noise

Page 27: CMSC  491/635

Resampling

Resampled Image Pixels

Continuous Image

Reconstruction Filter

Sampling Filter

Image Pixels

Page 28: CMSC  491/635

Resampling

Resampled Image Pixels

Resampling Filter

Image Pixels