Vous êtes sur la page 1sur 12

Convolution

1D convolution theorem example

Definition

h(x) = f " g = % f ( x #)g(x $ x #)dx #

Convolution Theorem: Multiplication in the frequency


domain is equivalent to convolution in the space
domain.

f " g # F $G
Symmetric Theorem: Multiplication in the space
domain is equivalent to convolution in the frequency
domain.
!

f "g # F $G

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

2D convolution theorem example


f(x,y)

g(x,y)

F(sx,sy)

h(x,y)

Dirac delta function, zero width, infinite height


and unit area

"

"

The delta function

!
"

"
G(sx,sy)

H(sx,sy)

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Sifting and shifting

Shah/impulse train function


spatial domain

frequency domain
,

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Sampling

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Reconstruction
band limited

The reconstructed function is obtained by interpolating


among the samples in some manner
slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

In math forms

Reconstruction filters

!!F = (F(s) """"#$%) # $(s)

!!f = ( f (x) """"(x)) # #$%&(x)

!
!

The sinc filter, while ideal,


has two drawbacks:
It has a large support (slow
to compute)
It introduces ringing in
practice

f (x) = $ "#$%(x " i) f (i)


i="#
!!
The box filter is bad because
its Fourier transform is a sinc
filter which includes high
frequency contribution from
the infinite series of other
copies.

!
slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Aliasing

increase sample
spacing in
spatial domain

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Aliasing

decrease sample
spacing in
frequency domain

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

high-frequency
details leak into
lower-frequency
regions

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Sampling theorem

Sampling theorem

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Aliasing due to under-sampling

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Sampling theorem
For band limited functions, we can just
increase the sampling rate
However, few interesting functions in computer
graphics are band limited, in particular,
functions with discontinuities.
It is primarily because the discontinuity always
falls between two samples and the samples
provides no information about this
discontinuity.

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Aliasing

Antialiasing

Prealiasing: due to sampling under Nyquist rate


Postaliasing: due to use of imperfect
reconstruction filter

Antialiasing = Preventing aliasing


1. Analytically prefilter the signal
Not solvable in general

2. Uniform supersampling and resample


3. Nonuniform or stochastic sampling

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Antialiasing (Prefiltering)

slide credits: Yung-Yu Chuang, Pat


slide
Hanrahan,
credit: Foley,
Torsten
VanDam,
Moller Feiner,
and Brian
andCurless
Hughes

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Antialiasing (Prefiltering)

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Antialiasing (Prefiltering)

Uniform supersampling
Increasing the sampling rate moves each copy
of the spectra further apart, potentially
reducing the overlap and thus aliasing
Resulting samples must be resampled (filtered)
to image sampling rate

Pixel = # w s " Samples


s

Samples

Pixel

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Point vs. Supersampled

Point

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Analytic vs. Supersampled

4x4 Supersampled

Exact Area

4x4 Supersampled

Checkerboard sequence by Tom Duff


slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Non-uniform sampling

Antialiasing (nonuniform sampling)

Uniform sampling

The impulse train is modified as

The spectrum of uniformly spaced samples is also a set of


uniformly spaced spikes
Multiplying the signal by the sampling pattern corresponds to
placing a copy of the spectrum at each spike (in freq. space)
Aliases are coherent (structured), and very noticeable

Non-uniform sampling
Samples at non-uniform locations have a different spectrum; a
single spike plus noise
Sampling a signal in this way converts aliases into broadband
noise
Noise is incoherent (structureless), and much less
objectionable

i=#+

&

, " ' x-%'& iT + 2 # $ (*) *


)

It turns regular aliasing into noise. But random


noise is less distracting than coherent aliasing.

Aliases cant be removed, but can be made less


noticeable.
slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Jittered vs. Uniform Supersampling

4x4 Jittered Sampling

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Jittered sampling

4x4 Uniform
Add uniform random jitter to each sample
slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Poisson disk noise (Yellott)

Example

Blue noise
Spectrum should be noisy and lack any
concentrated spikes of energy (to avoid
coherent aliasing)
Spectrum should have deficiency of lowfrequency energy (to hide aliasing in less
noticeable high frequency)

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Aliasing
frequency
domain

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Stochastic sampling
function (a)

function (b)

alias=false
frequency
slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Stochastic sampling
function (a)

Antialiasing (adaptive sampling)


function (b)

Take more samples only when necessary.


However, in practice, it is hard to know where
we need supersampling. Some heuristics could
be used.
It only makes a less aliased image, but may not
be more efficient than simple supersampling
particular for complex scenes.

Replace structure
alias by structureless
(high-freq) noise
slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Application to ray tracing

pbrt sampling interface

Sources of aliasing: object boundary, small


objects, textures and materials
Good news: we can do sampling easily
Bad news: we cant do prefiltering (because we
do not have the whole function)
Key insight: we can never remove all aliasing,
so we develop techniques to mitigate its impact
on the quality of the final image.

Creating good sample patterns can substantially


improve a ray tracers efficiency, allowing it to
create a high-quality image with fewer rays.
Because evaluating radiance is costly, it pays to
spend time on generating better sampling.
core/sampling.*, samplers/*
random.cpp, stratified.cpp,
bestcandidate.cpp,
lowdiscrepancy.cpp,

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

An ineffective sampler

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Random sampling

A more effective sampler

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Stratified sampling

a pixel

Subdivide the sampling domain into nonoverlapping regions (strata) and take a single
sample from each one so that it is less likely to
miss important features.

completely
random

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Stratified sampling

Comparison of sampling methods

256 samples per pixel as reference


completely
random

stratified
uniform

stratified
jittered
turns aliasing
into noise

1 sample per pixel (no jitter)

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Comparison of sampling methods

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Stratified sampling

1 sample per pixel (jittered)


reference

random

stratified
jittered

4 samples per pixel (jittered)


slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

High dimension

Stratified sampling

D dimension means ND cells.


Solution: make strata separately and associate
them randomly, also ensuring good
distributions.

image

time

lens

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

Stratified sampling

This is better because StratifiedSampler


could generate a good pattern for this case

1 camera sample and 16 shadow samples per pixel

16 camera samples and each with 1 shadow sample per pixel


slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless

slide credits: Yung-Yu Chuang, Pat Hanrahan, Torsten Moller and Brian Curless