Antialiasing - Computer Science and...
Transcript of Antialiasing - Computer Science and...
![Page 1: Antialiasing - Computer Science and Engineeringweb.cse.ohio-state.edu/.../16-antialiasing.pdfSdATblSummed Area Table Another way to perform anisotropic filteringAnother way to perform](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f0826127e708231d420948c/html5/thumbnails/1.jpg)
Antialiasing
Han-Wei Shen
![Page 2: Antialiasing - Computer Science and Engineeringweb.cse.ohio-state.edu/.../16-antialiasing.pdfSdATblSummed Area Table Another way to perform anisotropic filteringAnother way to perform](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f0826127e708231d420948c/html5/thumbnails/2.jpg)
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
![Page 3: Antialiasing - Computer Science and Engineeringweb.cse.ohio-state.edu/.../16-antialiasing.pdfSdATblSummed Area Table Another way to perform anisotropic filteringAnother way to perform](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f0826127e708231d420948c/html5/thumbnails/3.jpg)
Ali d b d liAlias caused by under-sampling
1D signal sampling example 1D signal sampling example
Actual signalSampled signal
![Page 4: Antialiasing - Computer Science and Engineeringweb.cse.ohio-state.edu/.../16-antialiasing.pdfSdATblSummed Area Table Another way to perform anisotropic filteringAnother way to perform](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f0826127e708231d420948c/html5/thumbnails/4.jpg)
Ali d b d liAlias caused by under-sampling
2D texture display example 2D texture display example
Minor aliasing worse aliasingMinor aliasing worse aliasing
![Page 5: Antialiasing - Computer Science and Engineeringweb.cse.ohio-state.edu/.../16-antialiasing.pdfSdATblSummed Area Table Another way to perform anisotropic filteringAnother way to perform](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f0826127e708231d420948c/html5/thumbnails/5.jpg)
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
![Page 6: Antialiasing - Computer Science and Engineeringweb.cse.ohio-state.edu/.../16-antialiasing.pdfSdATblSummed Area Table Another way to perform anisotropic filteringAnother way to perform](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f0826127e708231d420948c/html5/thumbnails/6.jpg)
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
![Page 7: Antialiasing - Computer Science and Engineeringweb.cse.ohio-state.edu/.../16-antialiasing.pdfSdATblSummed Area Table Another way to perform anisotropic filteringAnother way to perform](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f0826127e708231d420948c/html5/thumbnails/7.jpg)
R t ti FiltReconstruction Filters
Common reconstruction filters: Common reconstruction filters: Box filter Tent filter
Sinc filter = sin( x)/ xSinc filter = sin(x)/x
![Page 8: Antialiasing - Computer Science and Engineeringweb.cse.ohio-state.edu/.../16-antialiasing.pdfSdATblSummed Area Table Another way to perform anisotropic filteringAnother way to perform](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f0826127e708231d420948c/html5/thumbnails/8.jpg)
A ti li d t t iAnti-aliased texture mapping
Two problems to address Two problems to address – Magnification Minification
![Page 9: Antialiasing - Computer Science and Engineeringweb.cse.ohio-state.edu/.../16-antialiasing.pdfSdATblSummed Area Table Another way to perform anisotropic filteringAnother way to perform](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f0826127e708231d420948c/html5/thumbnails/9.jpg)
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)
![Page 10: Antialiasing - Computer Science and Engineeringweb.cse.ohio-state.edu/.../16-antialiasing.pdfSdATblSummed Area Table Another way to perform anisotropic filteringAnother way to perform](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f0826127e708231d420948c/html5/thumbnails/10.jpg)
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
![Page 11: Antialiasing - Computer Science and Engineeringweb.cse.ohio-state.edu/.../16-antialiasing.pdfSdATblSummed Area Table Another way to perform anisotropic filteringAnother way to perform](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f0826127e708231d420948c/html5/thumbnails/11.jpg)
M ifi tiMagnification
Common methods: nearest neighbor (box Common methods: nearest neighbor (box filter) or linear interpolation (tent filter)
Nearest neighbor bilinear interpolation
![Page 12: Antialiasing - Computer Science and Engineeringweb.cse.ohio-state.edu/.../16-antialiasing.pdfSdATblSummed Area Table Another way to perform anisotropic filteringAnother way to perform](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f0826127e708231d420948c/html5/thumbnails/12.jpg)
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
![Page 13: Antialiasing - Computer Science and Engineeringweb.cse.ohio-state.edu/.../16-antialiasing.pdfSdATblSummed Area Table Another way to perform anisotropic filteringAnother way to perform](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f0826127e708231d420948c/html5/thumbnails/13.jpg)
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
![Page 14: Antialiasing - Computer Science and Engineeringweb.cse.ohio-state.edu/.../16-antialiasing.pdfSdATblSummed Area Table Another way to perform anisotropic filteringAnother way to perform](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f0826127e708231d420948c/html5/thumbnails/14.jpg)
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
![Page 15: Antialiasing - Computer Science and Engineeringweb.cse.ohio-state.edu/.../16-antialiasing.pdfSdATblSummed Area Table Another way to perform anisotropic filteringAnother way to perform](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f0826127e708231d420948c/html5/thumbnails/15.jpg)
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
![Page 16: Antialiasing - Computer Science and Engineeringweb.cse.ohio-state.edu/.../16-antialiasing.pdfSdATblSummed Area Table Another way to perform anisotropic filteringAnother way to perform](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f0826127e708231d420948c/html5/thumbnails/16.jpg)
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
![Page 17: Antialiasing - Computer Science and Engineeringweb.cse.ohio-state.edu/.../16-antialiasing.pdfSdATblSummed Area Table Another way to perform anisotropic filteringAnother way to perform](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f0826127e708231d420948c/html5/thumbnails/17.jpg)
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
![Page 18: Antialiasing - Computer Science and Engineeringweb.cse.ohio-state.edu/.../16-antialiasing.pdfSdATblSummed Area Table Another way to perform anisotropic filteringAnother way to perform](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f0826127e708231d420948c/html5/thumbnails/18.jpg)
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
![Page 19: Antialiasing - Computer Science and Engineeringweb.cse.ohio-state.edu/.../16-antialiasing.pdfSdATblSummed Area Table Another way to perform anisotropic filteringAnother way to perform](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f0826127e708231d420948c/html5/thumbnails/19.jpg)
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
![Page 20: Antialiasing - Computer Science and Engineeringweb.cse.ohio-state.edu/.../16-antialiasing.pdfSdATblSummed Area Table Another way to perform anisotropic filteringAnother way to perform](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f0826127e708231d420948c/html5/thumbnails/20.jpg)
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)
![Page 21: Antialiasing - Computer Science and Engineeringweb.cse.ohio-state.edu/.../16-antialiasing.pdfSdATblSummed Area Table Another way to perform anisotropic filteringAnother way to perform](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f0826127e708231d420948c/html5/thumbnails/21.jpg)
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
![Page 22: Antialiasing - Computer Science and Engineeringweb.cse.ohio-state.edu/.../16-antialiasing.pdfSdATblSummed Area Table Another way to perform anisotropic filteringAnother way to perform](https://reader034.fdocuments.net/reader034/viewer/2022042319/5f0826127e708231d420948c/html5/thumbnails/22.jpg)
C iComparison
Non filtering
Mipmapping
Summed area table
Note that only mipmap is implemented by hardware and supported by OpenGL