Download Filtering theory: Battling Aliasing with Antialiasing What is aliasing

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Dither wikipedia , lookup

Apple II graphics wikipedia , lookup

Subpixel rendering wikipedia , lookup

Ringing artifacts wikipedia , lookup

Hold-And-Modify wikipedia , lookup

Original Chip Set wikipedia , lookup

Spatial anti-aliasing wikipedia , lookup

Transcript
What is aliasing?
Filtering theory:
Battling Aliasing with Antialiasing
Tomas Akenine-Möller
Department of Computer Engineering
Chalmers University of Technology
Tomas Akenine-Mőller © 2003
Physical correctness often less
important than filtering
Why care at all?
Quality!!
 Example: Final fantasy

–
–
The movie against the game
In a broad way, and for most of the scenes, the
only difference is in the number of samples and
the quality of filtering
Tomas Akenine-Mőller © 2003
Computer graphics is a
SAMPLING & FILTERING process!

Tomas Akenine-Mőller © 2003
Sampling and reconstruction
Pixels
DEMO


Texture




Time

Tomas Akenine-Mőller © 2003
Sampling: from continuous signal to discrete
Reconstruction recovers the original signal
Care must be taken to avoid aliasing
Nyquist theorem: the sampling frequency
should be at least 2 times the max frequency in
the signal
Often impossible to know max frequency
(bandlimited signal), or the max frequency is
often infinite…
Tomas Akenine-Mőller © 2003
1
Sampling is simple, now turn to:
Reconstruction
Sampling theorem

Nyquist theorem: the sampling frequency
should be at least 2 times the max
frequency in the signal
Assume we have a bandlimited signal
(e.g., a texture)
 Use filters for reconstruction

f=1 rpm
1 sample per revolution
A little more than 1 sample/revolution
2 samples per revolution
>2 samples per revolution
Tomas Akenine-Mőller © 2003
Tomas Akenine-Mőller © 2003
Reconstruction with box filter
(nearest neighbor)
Reconstruction with tent filter
Nearest neighbor
Linear
32x32
texture
Tomas Akenine-Mőller © 2003
Tomas Akenine-Mőller © 2003
Resampling
Reconstruction with sinc filter
Enlarging or diminishing signals
Assume samples are at unit-intervals,
i.e., 0,1,2,3,4,…
 Resample so that they are a apart


–
–
a< 1 gives magnification
a>1 gives minification
Nearest neighbor
In theory, the ideal filter
 Not practical (infinite extension, negative)

Tomas Akenine-Mőller © 2003
32x32
texture
Tomas Akenine-Mőller © 2003
2
Screen-based
Antialiasing
Formula and…
examples of different schemes
Hard case: edge has infinite frequency
 Supersampling: use more than one
sample per pixel
p( x, y )   wi c(i, x, y )

n
i 1
wi are the weights in [0,1]
 c(i,x,y) is the color of sample i inside pixel

Tomas Akenine-Mőller © 2003
Moire example
Jittered sampling





Tomas Akenine-Mőller © 2003
Regular sampling cannot eliminate aliasing –
only reduce it!
Why?
Because edges represent infinite frequency
Jittering replaces aliasing with noise
Example:
Moire patterns
Noise + gaussian blur
(no moire patterns)
Tomas Akenine-Mőller © 2003
The A-buffer
Multisampling technique
The A-buffer
Takes >1 samples per pixel, and shares
compuations between samples inside a
pixel
 Supersampling does not share
computations
 Examples:

–
–

Modified
Tomas Akenine-Mőller
by Ulf Assarsson,
© 2003
2004
Lighting may be computed once per pixel
Texturing may be computed once per pixel
Strength: aliasing edges and properly
handling transparency
To deal better with edges:
use a coverage mask per pixel
 Coverage mask, depth, & color
make up a fragment
 During rendering fragments are
discarded when possible (depth test)
 When all polygons have been rendered,
the fragments are merged into a visible
color

–
–
Tomas Akenine-Mőller © 2003
Allows for sorting transparent surfaces as well
But costs memory
Tomas Akenine-Mőller © 2003
3
Another multisampling techniqe
Quincunx
Yet another scheme:
FLIPQUAD multisampling

Recap, RGSS:
–




Generate 2 samples per pixel at the same time
w1=0.5, w2=0.125, w3=0.125, w4=0.125,
w5=0.125 (2D tent filter)
All samples gives the same effect on the image
(mid pixel = 0.5, corner pixels = 4*0.125=0.5)
Is available on NVIDIA GeForce3 and up
Tomas Akenine-Mőller © 2003
One sample per row
and column

Combine good stuff
from RGSS and Quincunx

Weights: 0.25 per sample
Performs better than
Quincunx

DEMO
Tomas Akenine-Mőller © 2003
More on filtering
theory and practice
Especially important for texturing and
filtering of textures
 More about this in next lecture

Tomas Akenine-Mőller © 2003
4