![Page 1: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/1.jpg)
Anti-Aliasing
Jian Huang
CS456
![Page 2: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/2.jpg)
Aliasing?
![Page 3: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/3.jpg)
Aliasing
• Aliasing comes from in-adequate
sampling rates of the continuous signal
• The theoretical foundation of anti-
aliasing has to do with frequency
analysis
• It’s always easier to look at 1D cases,
so let’s first look at a few of those.
![Page 4: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/4.jpg)
Example of Sampling
![Page 5: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/5.jpg)
Fourier Analysis
• By looking at F(u), we get a feel for the “frequencies” of the signal.
• We also call this frequency space.
• Intuitively, you can envision, the sharper an edge, the higher the frequencies.
• From a numerical analysis standpoint, the sharper the edge the greater the tangent magnitude, and hence the interpolation errors.
![Page 6: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/6.jpg)
Fourier Analysis
• Bandlimited
– We say a function is bandlimited, if F(u)=0
for all frequencies u>c and u<-c.
• Amplitude Spectrum
– The magnitude, |F(u)|, is called the
amplitude spectrum or simply the
spectrum.
• Phase Spectrum or Phase
))Re(
)Im((tan)( 1
u
uu =
![Page 7: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/7.jpg)
Fourier Properties
• Linearity
• Scaling
)()()()( ubGuaFxbgxaf ++
)(1
)(a
uF
aaxf
![Page 8: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/8.jpg)
Convolution
• Definition:
= dtxthtfxhxf )()()()(
![Page 9: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/9.jpg)
Convolution
• Pictorially
f(x)
h(x)
![Page 10: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/10.jpg)
Convolution
f(t)
x
h(t-x)
![Page 11: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/11.jpg)
Convolution
• Consider the function (box filter):
>
<
=
21
21
21
21
0
1
0
)(
x
x
x
xh
![Page 12: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/12.jpg)
Convolution
• This function windows our function f(x).
f(t)
![Page 13: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/13.jpg)
Convolution
• This function windows our function f(x).
f(t)
![Page 14: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/14.jpg)
Convolution
• This function windows our function f(x).
f(t)
![Page 15: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/15.jpg)
Convolution
• This function windows our function f(x).
f(t)
![Page 16: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/16.jpg)
Convolution
• This function windows our function f(x).
f(t)
![Page 17: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/17.jpg)
Convolution
• This function windows our function f(x).
f(t)
![Page 18: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/18.jpg)
Convolution
• This function windows our function f(x).
f(t)
![Page 19: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/19.jpg)
Convolution
• This function windows our function f(x).
f(t)
![Page 20: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/20.jpg)
Convolution
• This function windows our function f(x).
f(t)
![Page 21: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/21.jpg)
Convolution
• This function windows our function f(x).
f(t)
![Page 22: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/22.jpg)
Convolution
• This function windows our function f(x).
f(t)
![Page 23: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/23.jpg)
Convolution
• This function windows our function f(x).
f(t)
![Page 24: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/24.jpg)
Convolution
• This function windows our function f(x).
f(t)
![Page 25: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/25.jpg)
Convolution
• This function windows our function f(x).
f(t)
![Page 26: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/26.jpg)
Convolution
• This function windows our function f(x).
f(t)
![Page 27: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/27.jpg)
Convolution
• This function windows our function f(x).
f(t)
![Page 28: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/28.jpg)
Convolution
• This function windows our function f(x).
f(t)
![Page 29: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/29.jpg)
Convolution
• This function windows our function f(x).
f(t)
![Page 30: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/30.jpg)
Convolution
• This function windows our function f(x).
f(t)
![Page 31: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/31.jpg)
Convolution
• This function windows our function f(x).
f(t)
![Page 32: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/32.jpg)
Convolution
• This function windows our function f(x).
f(t)
![Page 33: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/33.jpg)
Convolution
• This function windows our function f(x).
f(t)
![Page 34: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/34.jpg)
Convolution
• This particular convolution smooths out
some of the high frequencies in f(x).
f(x) g(x) f(t)
![Page 35: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/35.jpg)
Another Look At Convolution
![Page 36: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/36.jpg)
Filtering and Convolution
Different functions
achieve different
Results.
![Page 37: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/37.jpg)
Aliasing
• What this says, is that any frequencies
greater than a certain amount will
appear intermixed with other
frequencies.
• In particular, the higher frequencies for
the copy at 1/T intermix with the low
frequencies centered at the origin.
![Page 38: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/38.jpg)
Aliasing and Sampling
• Note, that the sampling process
introduces frequencies out to infinity.
• We have also lost the function f(x), and
now have only the discrete samples.
• This brings us to our next powerful
theory.
![Page 39: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/39.jpg)
Sampling Theorem
• The Shannon Sampling Theorem
A band-limited signal f(x), with a cutoff frequency of
, that is sampled with a sampling spacing of T
may be perfectly reconstructed from the discrete
values f[nT] by convolution with the sinc(x)
function, provided:
is called the Nyquist limit. T2
1<
![Page 40: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/40.jpg)
Sampling Theory
• Why is this?
• The Nyquist limit will ensure that the
copies of F(u) do not overlap in the
frequency domain.
• I can completely reconstruct or
determine f(x) from F(u) using the
Inverse Fourier Transform.
![Page 41: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/41.jpg)
Sampling Theory
• In order to do this, I need to remove all
of the shifted copies of F(u) first.
• This is done by simply multiplying F(u)
by a box function of width 2 .
F(u)
T
1
S(u)
![Page 42: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/42.jpg)
Sampling Theory
• In order to do this, I need to remove all
of the shifted copies of F(u) first.
• This is done by simply multiplying F(u)
by a box function of width 2 .
F(u) S(u)
T
1
![Page 43: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/43.jpg)
General Process Original function Sampled function
Reconstructed
Function
Acquisition
Re-sampled function
Resampling
![Page 44: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/44.jpg)
Interpolation (an example) • Very important; regardless of algorithm
• expensive => done very often for one image
• Requirements for good reconstruction – performance
– stability of the numerical algorithm
– accuracy
Nearest neighbor
Linear
![Page 45: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/45.jpg)
Sampling and Anti-aliasing
• The images were calculated as follows:
– A 2Kx2K image was constructed
and smoothly rotated into 3D.
– For Uniform Sampling, it was
downsampled to a 512x512 image.
– Noise was added to the image,
sharpened and then downsampled for the other one.
– Both were converted to B&W.
![Page 46: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/46.jpg)
Sampling and Anti-aliasing
• The problem:
– The signal is not band-limited.
– Uniform sampling can pick-up higher
frequency patterns and represent them as
low-frequency patterns.
F(u)
T
1
S(u)
![Page 47: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/47.jpg)
Quality considerations
• So far we just mapped one point • results in bad aliasing (resampling
problems) • we really need to integrate over
polygon • super-sampling is not a very good
solution (slow!) • most popular (easiest) - mipmaps
![Page 48: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/48.jpg)
Quality considerations
• Pixel area maps to “weird” (warped) shape in texture space
pixel
u
v
xs
ys
![Page 49: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/49.jpg)
Quality considerations
• We need to: – Calculate (or approximate) the integral
of the texture function under this area – Approximate:
• Convolve with a wide filter around the center of this area
• Calculate the integral for a similar (but simpler) area.
![Page 50: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/50.jpg)
Quality considerations
• the area is typically approxiated by a rectangular region (found to be good enough for most applications)
• filter is typically a box/averaging filter - other possibilities
• how can we pre-compute this?
![Page 51: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/51.jpg)
Mip-maps
• An image-pyramid is built. 256 pixels 128 64 32 16 8 4 2 1
![Page 52: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/52.jpg)
Mip-maps
• Find level of the mip-map where the
area of each mip-map pixel is closest to
the area of the mapped pixel.
pixel
u
v
xs
ys
2x2 pixels level selected
![Page 53: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/53.jpg)
Mip-maps
• Pros
– Easy to calculate: • Calculate pixels area in texture space
• Determine mip-map level
• Sample or interpolate to get color
• Cons – Area not very close – restricted to square
shapes (64x64 is far away from 128x128).
– Location of area is not very tight.
![Page 54: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/54.jpg)
Summed Area Table (SAT)
• Use an axis aligned rectangle, rather
than a square
• Precompute the sum of all texels to the
left and below for each texel location
– For texel (u,v), replace it with:
sum (texels(i=0…u,j=0…v))
![Page 55: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/55.jpg)
Summed Area Table (SAT)
• Determining the rectangle:
– Find bounding box and calculate its aspect
ratio
pixel
u
v
xs
ys
![Page 56: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/56.jpg)
Summed Area Table (SAT)
• Determine the rectangle with the same aspect
ratio as the bounding box and the same area
as the pixel mapping.
pixel
u
v
xs
ys
![Page 57: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/57.jpg)
Summed Area Table (SAT)
• Center this rectangle around the bounding box center.
• Formula: • Area = aspect_ratio*x*x
• Solve for x – the width of the rectangle
• Other derivations are also possible using the aspects of the diagonals, …
![Page 58: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/58.jpg)
Summed Area Table (SAT)
• Calculating the color
– We want the average of the texel colors
within this rectangle
u
v +
+ -
-
(u3,v3)
(u2,v2) (u1,v1)
(u4,v4)
+ -
+ -
![Page 59: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/59.jpg)
Summed Area Table (SAT)
• To get the average, we need to divide by the number of texels falling in the rectangle. – Color = SAT(u3,v3)-SAT(u4,v4)-SAT(u2,v2)+SAT(u1,v1)
– Color = Color / ( (u3-u1)*(v3-v1) )
• This implies that the values for each texel may be very large: – For 8-bit colors, we could have a maximum SAT value of
255*nx*ny
– 32-bit pixels would handle a 4kx4k texture with 8-bit values.
– RGB images imply 12-bytes per pixel.
![Page 60: Anti-Aliasing - UTKweb.eecs.utk.edu/~huangj/cs452/notes/452_aliasing.pdf · Aliasing • Aliasing comes from in-adequate sampling rates of the continuous signal • The theoretical](https://reader034.vdocuments.us/reader034/viewer/2022052423/5f0826137e708231d4209490/html5/thumbnails/60.jpg)
Summed Area Table (SAT)
• Pros – Still relatively simple
• Calculate four corners of rectangle
• 4 look-ups, 5 additions, 1 mult and 1 divide.
– Better fit to area shape
– Better overlap
• Cons – Large texel SAT values needed
– Still not a perfect fit to the mapped pixel.