Advanced Computer Graphics: Sampling, Aliasing, and Anti-Aliasing Techniques, Study notes of Computer Science

Various topics in advanced computer graphics, including pixels, aliasing, sampling and reconstruction, filters, and anti-aliasing for texture maps. The concepts of pixels, aliasing, and sampling density, and discusses the importance of fourier analysis and convolution in computer graphics. It also explores different types of filters, such as pre-filtering and post-filtering, and their impact on image quality.

Typology: Study notes

Pre 2010

Uploaded on 08/09/2009

koofers-user-za4
koofers-user-za4 🇺🇸

10 documents

1 / 10

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
CSCI-6962 Advanced Computer Graphics Cutler
Sampling,
Aliasing,
& Mipmaps
CSCI-6962 Advanced Computer Graphics Cutler
Last Time?
CSCI-6962 Advanced Computer Graphics Cutler
(a) Chosen uniformly
within the cone of
directions subtended
by each light source
4 samples / pixel
(b) Chosen with
probability
proportional
to the BRDF
4 samples / pixel
(c) Weighted
combination of
(a) & (b)
8 samples / pixel
“Optimally combining
sampling techniques for
Monte Carlo rendering”
Veach & Guibas SIGGRAPH 1995
Importance Sampling
CSCI-6962 Advanced Computer Graphics Cutler
Today
What is a Pixel?
Examples of Aliasing
Sampling & Reconstruction
Filters in Computer Graphics
Anti-Aliasing for Texture Maps
CSCI-6962 Advanced Computer Graphics Cutler
What is a Pixel?
A pixel is not:
–a box
–a disk
a teeny tiny little light
A pixel “looks different” on
different display devices
A pixel is a sample
it has no dimension
it occupies no area
it cannot be seen
it has a coordinate
it has a value
CSCI-6962 Advanced Computer Graphics Cutler
More on Samples
Most things in the real world are continuous,
yet everything in a computer is discrete
The process of mapping a continuous function
to a discrete one is called sampling
The process of mapping a continuous variable
to a discrete one is called quantization
To represent or render an image using a computer,
we must both sample and quantize
discrete position
discrete
value
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Advanced Computer Graphics: Sampling, Aliasing, and Anti-Aliasing Techniques and more Study notes Computer Science in PDF only on Docsity!

CSCI-6962 Advanced Computer Graphics Cutler

Sampling,

Aliasing,

& Mipmaps

CSCI-6962 Advanced Computer Graphics Cutler

Last Time?

CSCI-6962 Advanced Computer Graphics Cutler

(a) Chosen uniformly

within the cone of

directions subtended

by each light source

4 samples / pixel

(b) Chosen with

probability

proportional

to the BRDF

4 samples / pixel

(c) Weighted

combination of

(a) & (b)

8 samples / pixel

“Optimally combining

sampling techniques for

Monte Carlo rendering”

Veach & Guibas SIGGRAPH 1995

Importance Sampling

CSCI-6962 Advanced Computer Graphics Cutler

Today

• What is a Pixel?

• Examples of Aliasing

• Sampling & Reconstruction

• Filters in Computer Graphics

• Anti-Aliasing for Texture Maps

CSCI-6962 Advanced Computer Graphics Cutler

What is a Pixel?

• A pixel is not:

  • a box
  • a disk
  • a teeny tiny little light

• A pixel “looks different” on

different display devices

• A pixel is a sample

  • it has no dimension
  • it occupies no area
  • it cannot be seen
  • it has a coordinate
  • it has a value

CSCI-6962 Advanced Computer Graphics Cutler

More on Samples

  • Most things in the real world are continuous ,

yet everything in a computer is discrete

  • The process of mapping a continuous function

to a discrete one is called sampling

  • The process of mapping a continuous variable

to a discrete one is called quantization

  • To represent or render an image using a computer,

we must both sample and quantize

discrete position

discrete

value

CSCI-6962 Advanced Computer Graphics Cutler

An Image is a 2D Function

  • An ideal image is a continuous function I(x,y) of intensities.
  • It can be plotted as a height field.
  • In general an image

cannot be represented

as a continuous,

analytic function.

  • Instead we represent

images as tabulated

functions.

  • How do we fill

this table?

CSCI-6962 Advanced Computer Graphics Cutler

Sampling Grid

  • We can generate the table values by multiplying the continuous

image function by a sampling grid of Kronecker delta functions.

CSCI-6962 Advanced Computer Graphics Cutler

Sampling an Image

  • The result is a set of point samples, or pixels.

CSCI-6962 Advanced Computer Graphics Cutler

Questions?

CSCI-6962 Advanced Computer Graphics Cutler

Today

  • What is a Pixel?
  • Examples of Aliasing
  • Sampling & Reconstruction
  • Filters in Computer Graphics
  • Anti-Aliasing for Texture Maps

CSCI-6962 Advanced Computer Graphics Cutler

Examples of Aliasing

  • Aliasing occurs because of sampling and

reconstruction

CSCI-6962 Advanced Computer Graphics Cutler

Sampling Density

  • If we insufficiently sample the signal, it may be

mistaken for something simpler during reconstruction

(that's aliasing!)

Image from Robert L. Cook,

"Stochastic Sampling and

Distributed Ray Tracing",

An Introduction to Ray Tracing,

Andrew Glassner, ed.,

Academic Press Limited, 1989.

CSCI-6962 Advanced Computer Graphics Cutler

Sampling Density

  • Aliasing in 2D because of insufficient

sampling density

CSCI-6962 Advanced Computer Graphics Cutler

Images from

http://axion.physics.ubc.ca/341-02/fourier/fourier.html

Remember Fourier Analysis?

  • All periodic signals

can be represented

as a summation of

sinusoidal waves.

CSCI-6962 Advanced Computer Graphics Cutler

Remember Fourier Analysis?

  • Every periodic signal in the spatial domain has a

dual in the frequency domain.

  • This particular signal is band-limited , meaning it

has no frequencies above some threshold

spatial domain frequency domain

CSCI-6962 Advanced Computer Graphics Cutler

Remember Fourier Analysis?

  • We can transform from one domain to the other

using the Fourier Transform.

frequency domain spatial domain

Fourier

Transform

Inverse

Fourier

Transform

CSCI-6962 Advanced Computer Graphics Cutler

Remember Convolution?

Images from Mark Meyer

http://www.gg.caltech.edu/~cs174ta/

CSCI-6962 Advanced Computer Graphics Cutler

Remember Convolution?

  • Some operations that are difficult to compute in the

spatial domain can be simplified by transforming to its

dual representation in the frequency domain.

  • For example, convolution in the spatial domain is the

same as multiplication in the frequency domain.

  • And, convolution in the frequency domain is the same

as multiplication in the spatial domain

CSCI-6962 Advanced Computer Graphics Cutler

Sampling in the Frequency Domain

(multiplication) (convolution)

original

signal

sampling

grid

sampled

signal

Fourier Transform

Fourier Transform

Fourier Transform

CSCI-6962 Advanced Computer Graphics Cutler

Reconstruction

  • If we can extract a copy of the original signal

from the frequency domain of the sampled

signal, we can reconstruct the original signal!

  • But there may be

overlap between

the copies.

CSCI-6962 Advanced Computer Graphics Cutler

Guaranteeing Proper Reconstruction

  • Separate by removing high

frequencies from the original

signal (low pass pre-filtering)

  • Separate by increasing the sampling density
  • If we can't separate the copies, we will have overlapping

frequency spectrum during reconstruction → aliasing.

CSCI-6962 Advanced Computer Graphics Cutler

Sampling Theorem

  • When sampling a signal at discrete

intervals, the sampling frequency must be

greater than twice the highest frequency of

the input signal in order to be able to

reconstruct the original perfectly from the

sampled version (Shannon, Nyquist)

CSCI-6962 Advanced Computer Graphics Cutler

Questions?

CSCI-6962 Advanced Computer Graphics Cutler

Problems with Practical Filters

  • Many visible artifacts in re-sampled images are caused

by poor reconstruction filters

  • Excessive pass-band attenuation results in blurry images
  • Excessive high-frequency leakage

causes "ringing" and

can accentuate the

sampling grid

(anisotropy)

frequency

CSCI-6962 Advanced Computer Graphics Cutler

Gaussian Filter

  • This is what a CRT

does for free!

spatial

frequency

CSCI-6962 Advanced Computer Graphics Cutler

Box Filter / Nearest Neighbor

  • Pretending pixels

are little squares.

spatial

frequency

CSCI-6962 Advanced Computer Graphics Cutler

Tent Filter / Bi-Linear Interpolation

  • Simple to implement
  • Reasonably smooth

spatial

frequency

CSCI-6962 Advanced Computer Graphics Cutler

Bi-Cubic Interpolation

  • Begins to approximate

the ideal spatial filter,

the sinc function

spatial

frequency

CSCI-6962 Advanced Computer Graphics Cutler

Why is the Box Filter Bad?

  • (Why is it bad to think of pixels as squares)

Down-sampled with

a 5x5 box filter

(uniform weights)

Original high-

resolution image

Down-sampled with

a 5x5 Gaussian filter

(non-uniform weights)

notice the ugly

horizontal banding

CSCI-6962 Advanced Computer Graphics Cutler

Questions?

CSCI-6962 Advanced Computer Graphics Cutler

Today

  • What is a Pixel?
  • Examples of Aliasing
  • Sampling & Reconstruction
  • Filters in Computer Graphics
  • Anti-Aliasing for Texture Maps
    • Magnification & Minification
    • Mipmaps
    • Anisotropic Mipmaps

CSCI-6962 Advanced Computer Graphics Cutler

Sampling Texture Maps

  • When texture mapping it is rare that the screen-space

sampling density matches the sampling density of the

texture.

Original Texture Magnification for Display Minification for Display

for which we must use a reconstruction filter

64x64 pixels

CSCI-6962 Advanced Computer Graphics Cutler

Linear Interpolation

  • Tell OpenGL to use a tent filter instead of a box filter.
  • Magnification looks better, but blurry
    • (texture is under-sampled for this resolution)

box filter tent filter

CSCI-6962 Advanced Computer Graphics Cutler

Spatial Filtering

  • Remove the high frequencies

which cause artifacts in texture

minification.

  • Compute a spatial integration

over the extent of the pixel

  • This is equivalent to convolving

the texture with a filter kernel

centered at the sample (i.e.,

pixel center)!

  • Expensive to do during

rasterization, but an

approximation it can be

precomputed

projected texture in image plane

box filter in texture plane

CSCI-6962 Advanced Computer Graphics Cutler

MIP Mapping

  • Construct a pyramid

of images that are

pre-filtered and

re-sampled at

1/2, 1/4, 1/8, etc.,

of the original

image's sampling

  • During rasterization

we compute the index of the decimated image that is sampled at

a rate closest to the density of our desired sampling rate

  • MIP stands for multum in parvo which means

many in a small place

CSCI-6962 Advanced Computer Graphics Cutler

Anisotropic MIP-Mapping

  • We can use

different

mipmaps for

the 2 directions

  • Additional

extensions can

handle non

axis-aligned

views

Images from http://www.sgi.com/software/opengl/advanced98/notes/node37.html

CSCI-6962 Advanced Computer Graphics Cutler

Questions?