MAE152 Computer Graphics for Scientists and Engineers Antialiasing Fall 2003.
Antialiasing - Department of Computer Science and Engineering
Transcript of Antialiasing - Department of Computer Science and Engineering
Antialiasing
Han-Wei Shen
Wh t i li ?What is alias? Alias A false signal in telecommunication links from Alias - A false signal in telecommunication links from
beats between signal frequency and sampling frequency(from dictionary.com)(from dictionary.com) Not just telecommunication, alias is everywhere in
computer graphics because rendering is essentially a lisampling process
Examples: Jagged edges Jagged edges False texture patterns
Ali d b d liAlias caused by under-sampling
1D signal sampling example 1D signal sampling example
Actual signalSampled signal
Ali d b d liAlias caused by under-sampling
2D texture display example 2D texture display example
Minor aliasing worse aliasingMinor aliasing worse aliasing
H ft i h?How often is enough?
What is the right sampling frequency? What is the right sampling frequency? Sampling theorem (or Nyquist limit) - the
li f h t b t l t t isampling frequency has to be at least twice the maximum frequency of the signal to be sampledsampled
Need two samples in this cycle
R t tiReconstruction
After the (ideal) sampling is done we need to After the (ideal) sampling is done, we need to reconstruct back the original continuous signalsignal
The reconstruction is done by reconstruction filterfilter
R t ti FiltReconstruction Filters
Common reconstruction filters: Common reconstruction filters: Box filter Tent filter
Sinc filter = sin( x)/ xSinc filter = sin(x)/x
A ti li d t t iAnti-aliased texture mapping
Two problems to address Two problems to address – Magnification Minification
R liRe-sampling
Minification and Magnification resample the Minification and Magnification – resample the signal to a different resolution
Minification
Magnification
(note the minification is done badly here)
M ifi tiMagnification
Simpler to handle just resample the Simpler to handle, just resample the reconstructed signal
Reconstructed signal Resample the reconstructed signalg p g
M ifi tiMagnification
Common methods: nearest neighbor (box Common methods: nearest neighbor (box filter) or linear interpolation (tent filter)
Nearest neighbor bilinear interpolation
Mi ifi tiMinification
Harder to handle Harder to handle The signal’s frequency is too high to avoid
li ialiasing A possible solution: Increase the low pass filter width of the ideal sinc
filter – this effectively blur the imageBlur the image first (using any method) and then Blur the image first (using any method), and then sample it
Mi ifi tiMinification Several texels cover one pixel (under
sampling happens) Solution:
Either increase samplingrate or reduce the textureFrequency
Under sample artifactone pixel We will discuss:
1. Mip-mapping p pp g2. Rip-mapping3. Sum Area Table
Mi iMip-mapping By Lance Williams
average 2x2 texels By Lance Williams
(SIGGRAPH ’83) Mip – many things in a
ll l
texels
d=3
…
small place The original texture is
augmented with a set of low d=2
resolution textures Which resolution to use
depends on the screen d=1depends on the screen projection size – try to maintain pixel to texel ration close to 1
d=1
ration close to 1
Mi iMipmapping
Two common measures are used to compute d Two common measures are used to compute d. Use the longer edge of the quadrilateral
U th l t b l t l f th f Use the largest absolute value of the four differentials (u/x, v/x, u/y, v/y)
I l b l l Interpolate between levels
Mi i blMipmapping problem
Overblurring! When a pixel covers many u Overblurring! – When a pixel covers many u texels but few v texels, we always choose the largest pixel coverage to decide the levellargest pixel coverage to decide the level
Non mipmapping
mipmapping
Ri iRipmapping Correct the over-blurring problem of Correct the over blurring problem of
mipmapping – separating x and y filtering
• Scale by half by x across a row.
• Scale by half in yScale by half in y going down a column.
• The diagonal has the i l t iequivalent mip-map.
• Four times the amount of storage is required.
• Four different texel values to average
S d A T blSummed Area Table
Another way to perform anisotropic filtering Another way to perform anisotropic filtering -can be used to compute the average color for any arbitrary rectangular region in the textureany arbitrary rectangular region in the texture space at a constant speed
A two dimensional array that has the same A two dimensional array that has the same size as the texture
Every pixel stores the sum of all the texel colors in thelower left corner
S d A T bl (SAT)Summed Area Table (SAT)
How to calculate the sum of texels in the area How to calculate the sum of texels in the area between A and B?
BCR = SAT[B] – SAT[C] – SAT[D] + SAT[A]
RA
BC
DThe average value can be computed by
R / num of texels in R
S d A T bl (SAT)Summed Area Table (SAT)
is used to filter the texture is used to filter the texture
polygon Texture spacep
y
pixel
Compute the rectangular bounding box of the pixel area in the texture and thend t bl t t th l (i filt th t l h
x
use summed area table to compute the average color (i.e., filter the texels when magnification takes place)
S d A T blSummed Area Table
Less blurry than Mipmapping Less blurry than Mipmapping Still blurry when the texture is viewed along
it di l thi i b th b diits diagonal – this is because the bounding box of the pixel area is larger than the actual pixel areapixel area
polygon Texture spacenot quit fit
y
pixel x
C iComparison
Non filtering
Mipmapping
Summed area table
Note that only mipmap is implemented by hardware and supported by OpenGL