sampling, aliasing, and mipmaps - mit opencourseware · –in the case of audio, people first...
TRANSCRIPT
![Page 1: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/1.jpg)
Sampling, Aliasing,
& Mipmaps
1
MIT EECS 6.837 Computer Graphics
Wojciech Matusik, MIT EECS
![Page 2: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/2.jpg)
Examples of Aliasing
2
© Rosalee Nerheim-Wolfe, Toby Howard, Stephen Spencer. All rights reserved. This content is excluded fromour Creative Commons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.
![Page 3: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/3.jpg)
Examples of Aliasing
3
© Rosalee Nerheim-Wolfe, Toby Howard, Stephen Spencer. All rights reserved. This content is excluded fromour Creative Commons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.
![Page 4: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/4.jpg)
Examples of Aliasing
4
© Rosalee Nerheim-Wolfe, Toby Howard, Stephen Spencer. All rights reserved. This content is excludedfrom our Creative Commons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.
![Page 5: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/5.jpg)
Examples of Aliasing Texture Errors
point sampling
5
![Page 6: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/6.jpg)
In photos too
See also http://vimeo.com/26299355
6
© source unknown. All rights reserved. This content is excluded from our CreativeCommons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.
![Page 7: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/7.jpg)
Philosophical perspective • The physical world is continuous, inside the
computer things need to be discrete • Lots of computer graphics is about translating
continuous problems into discrete solutions – e.g. ODEs for physically-based animation, global
illumination, meshes to represent smooth surfaces, rasterization, antialiasing
• Careful mathematical understanding helps do the right thing
7
![Page 8: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/8.jpg)
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
8
© source unknown. All rights reserved. This content isexcluded from our Creative Commons license. For moreinformation, see http://ocw.mit.edu/help/faq-fair-use/.
![Page 9: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/9.jpg)
• In signal processing, 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
– Gamma helps quantization
• To represent or render an image using a computer, we must both sample and quantize – Today we focus on the effects of sampling and how to fight them
More on Samples
discrete position
discrete value
9
![Page 10: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/10.jpg)
Sampling & reconstruction The visual array of light is a continuous function 1/ we sample it
– with a digital camera, or with our ray tracer – This gives us a finite set of numbers,
not really something we can see – We are now inside the discrete computer world
2/ we need to get this back to the physical world: we reconstruct a continuous function – for example, the point spread of a pixel on a CRT or LCD
• Both steps can create problems – pre-aliasing caused by sampling – post-aliasing caused by reconstruction – We focus on the former
10
![Page 11: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/11.jpg)
Sampling & reconstruction The visual array of light is a continuous function 1/ we sample it
– with a digital camera, or with our ray tracer – This gives us a finite set of numbers,
not really something we can see – We are now inside the discrete computer world
2/ we need to get this back to the physical world: we reconstruct a continuous function – for example, the point spread of a pixel on a CRT or LCD
• Both steps can create problems – pre-aliasing caused by sampling – post-aliasing caused by reconstruction – We focus on the former
11
Questions?
![Page 12: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/12.jpg)
Sampling Density
• If we’re lucky, sampling density is enough
Input Reconstructed 12
![Page 13: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/13.jpg)
Sampling Density
• If we insufficiently sample the signal, it may be mistaken for something simpler during reconstruction (that's aliasing!)
• This is why it’s called aliasing: the new low-frequency sine wave is an alias/ghost of the high-frequency one
13
![Page 14: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/14.jpg)
Discussion • Types of aliasing
– Edges • mostly directional
aliasing (vertical and horizontal edges rather than actual slope)
– Repetitive textures • Paradigm of aliasing • Harder to solve right • Motivates fun
mathematics
14
© Rosalee Nerheim-Wolfe, Toby Howard, Stephen Spencer. All rightsreserved. This content is excluded from our Creative Commons license.For more information, see http://ocw.mit.edu/help/faq-fair-use/.
![Page 15: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/15.jpg)
Solution? • How do we avoid that high-frequency patterns
mess up our image?
15
![Page 16: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/16.jpg)
Solution? • How do we avoid that high-frequency patterns
mess up our image? • We blur!
– In the case of audio, people first include an analog low-pass filter before sampling
– For ray tracing/rasterization: compute at higher resolution, blur, resample at lower resolution
– For textures, we can also blur the texture image before doing the lookup
• To understand what really happens, we need serious math
16
![Page 17: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/17.jpg)
Solution? • How do we avoid that high-frequency patterns
mess up our image? • We blur!
– In the case of audio, people first include an analog low-pass filter before sampling
– For ray tracing/rasterization: compute at higher resolution, blur, resample at lower resolution
– For textures, we can also blur the texture image before doing the lookup
• To understand what really happens, we need serious math
17
Questions?
![Page 18: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/18.jpg)
• Your intuitive solution is to compute multiple color values per pixel and average them
In practice: Supersampling
jaggies w/ antialiasing
18
![Page 19: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/19.jpg)
Uniform supersampling • Compute image at resolution k*width, k*height • Downsample using low-pass filter
(e.g. Gaussian, sinc, bicubic)
19
![Page 20: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/20.jpg)
Low pass / convolution • Each output (low-res) pixel is a weighted average
of input subsamples • Weight depends on relative spatial position • For example:
– Gaussian as a function of distance – 1 inside a square, zero outside (box)
20 http://homepages.inf.ed.ac.uk/rbf/HIPR2/gsmooth.htm
© 2003 R. Fisher, S. Perkins, A. Walker and E. Wolfart. All rights reserved. This content is excluded fromour Creative Commons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.
![Page 21: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/21.jpg)
In practice: Supersampling • Your intuitive solution is to
compute multiple color values per pixel and average them
• A better interpretation of the same idea is that – You first create a higher resolution
image – You blur it (low pass, prefilter) – You resample it at a lower resolution
21
Images removed due to copyright restrictions.
![Page 22: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/22.jpg)
22
© source unknown. All rights reserved. This content is excluded from our CreativeCommons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.
![Page 23: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/23.jpg)
Recommended filter • Bicubic
– http://www.mentallandscape.com/Papers_siggraph88.pdf
• Good tradeoff between sharpness and aliasing
23 http://de.wikipedia.org/wiki/Datei:Mitchell_Filter.svg
![Page 24: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/24.jpg)
Piecewise-cubic • General formula
where P, Q, R, S, T, U, V, W are parameters • But we want the derivatives to be zero at the
boundary and constant signals to be well reconstructed. Reduces to 2 parameters
24
![Page 25: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/25.jpg)
Choosing the parameters • Empirical tests determined usable parameters
– Mitchell, Don and Arun Netravali, "Reconstruction Filters in Computer Graphics", SIGGRAPH 88.
http://www.mentallandscape.com/Papers_siggraph88.pdf http://dl.acm.org/citation.cfm?id=378514
25
© ACM. All rights reserved. This content is excluded from our Creative Commonslicense. For more information, see http://ocw.mit.edu/help/faq-fair-use/.
![Page 26: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/26.jpg)
Box
26 http://www.willsmith.org/maya_gi_tutorial_1/Wills_Maya_GI_Tweaking_Guide_1.html
© Will Smith. All rights reserved. This content is excluded from our Creative Commonslicense. For more information, see http://ocw.mit.edu/help/faq-fair-use/.
![Page 27: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/27.jpg)
Gauss
27 http://www.willsmith.org/maya_gi_tutorial_1/Wills_Maya_GI_Tweaking_Guide_1.html
© Will Smith. All rights reserved. This content is excluded from our Creative Commonslicense. For more information, see http://ocw.mit.edu/help/faq-fair-use/.
![Page 28: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/28.jpg)
Mitchell bicubic
28 http://www.willsmith.org/maya_gi_tutorial_1/Wills_Maya_GI_Tweaking_Guide_1.html
© Will Smith. All rights reserved. This content is excluded from our Creative Commonslicense. For more information, see http://ocw.mit.edu/help/faq-fair-use/.
![Page 29: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/29.jpg)
Box
29 http://rise.sourceforge.net/cgi-bin/makepage.cgi?Filtering
© Aravind Krishnaswamy. All rights reserved. This content is excluded from our CreativeCommons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.
![Page 30: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/30.jpg)
Mitchell-Netravali cubic (1/3. 1/3)
30 http://rise.sourceforge.net/cgi-bin/makepage.cgi?Filtering
© Aravind Krishnaswamy. All rights reserved. This content is excluded from our CreativeCommons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.
![Page 31: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/31.jpg)
Box
31
© source unknown. All rights reserved. This content is excluded from our CreativeCommons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.
![Page 32: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/32.jpg)
Gaussian
32
© source unknown. All rights reserved. This content is excluded from our CreativeCommons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.
![Page 33: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/33.jpg)
Mitchell-Netravali cubic
33
© source unknown. All rights reserved. This content is excluded from our CreativeCommons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.
![Page 34: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/34.jpg)
Uniform supersampling • Advantage:
– The first (super)sampling captures more high frequencies that are not aliased
– Downsampling can use a good filter • Issues
– Frequencies above the (super)sampling limit are still aliased
• Works well for edges, since spectrum replication is less an issue
• Not as well for repetitive textures – But solution soon
34
![Page 35: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/35.jpg)
Uniform supersampling • Advantage:
– The first (super)sampling captures more high frequencies that are not aliased
– Downsampling can use a good filter • Issues
– Frequencies above the (super)sampling limit are still aliased
• Works well for edges, since spectrum replication is less an issue
• Not as well for repetitive textures – But solution soon
35
Questions?
![Page 36: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/36.jpg)
Uniform supersampling • Problem: supersampling only pushes the problem
further: The signal is still not bandlimited • Aliasing happens • Especially if the signal and the sampling are
regular
36
![Page 37: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/37.jpg)
Jittering • Uniform sample + random perturbation • Sampling is now non-uniform • Signal processing gets more complex • In practice, adds noise to image • But noise is better than aliasing Moiré patterns
37
![Page 38: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/38.jpg)
1 sample / pixel
0 jittering jittering by 0.5 jittering by 1
Jittered supersampling
38
![Page 39: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/39.jpg)
1 sample / pixel
2 sample / pixel 0 jittering jittering by 0.5 jittering by 1
Jittered supersampling
39
![Page 40: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/40.jpg)
Jittering • Displaced by a vector a fraction of the size of the
subpixel distance • Low-frequency Moire (aliasing) pattern replaced
by noise • Extremely effective • Patented by Pixar! • When jittering amount is 1, equivalent to
stratified sampling (cf. later)
40
![Page 41: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/41.jpg)
Recap: image antialiasing • Render multiple samples per pixel • Jitter the sample locations • Use appropriate filter to reconstruct final image
– Bicubic for example
41
![Page 42: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/42.jpg)
Recap: image antialiasing • Render multiple samples per pixel • Jitter the sample locations • Use appropriate filter to reconstruct final image
– Bicubic for example
42
Questions?
![Page 43: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/43.jpg)
• How to map the texture area seen through the pixel window to a single pixel value?
Sampling Texture Maps
image plane
textured surface (texture map)
circular pixel window
43
![Page 44: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/44.jpg)
Sampling Texture Maps • When texture mapping it is rare that the screen-space
sampling density matches the sampling density of the texture.
Original Texture Minification for Display Magnification for Display
64x64 pixels
44
![Page 45: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/45.jpg)
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) – Oh well.
45
![Page 46: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/46.jpg)
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) – Oh well.
46
Questions?
![Page 47: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/47.jpg)
Minification: Examples of Aliasing
point sampling
47
![Page 48: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/48.jpg)
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
pixels projected in texture plane 48
![Page 49: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/49.jpg)
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
49
![Page 50: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/50.jpg)
MIP Mapping Example
MIP Mapped (Bi-Linear) Nearest Neighbor
50
![Page 51: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/51.jpg)
MIP Mapping Example • Small details may "pop" in and out of view
MIP Mapped (Bi-Linear) Nearest Neighbor
51
![Page 52: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/52.jpg)
Examples of Aliasing Texture Errors
nearest neighbor/ point sampling
mipmaps & linear interpolation
52
![Page 53: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/53.jpg)
Finding the mip level
• Square MIP-map area is a bad approximation
image plane
textured surface (texture map)
circular pixel window
area pre- filtered in MIP-
map
53
![Page 54: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/54.jpg)
How does a screen-space change dt relates to a texture-space change du,dv.
=> derivatives, ( du/dt, dv/dt ).
e.g. computed by hardware during rasterization
often: finite difference (pixels are handled by quads)
Finding the MIP level
dt
du, dv
54
![Page 55: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/55.jpg)
MIP Indices Actually, you have a choice of ways to translate this derivative value into a MIP level.
Because we have two derivatives, for u and for v (anisotropy)
This also brings up one of the shortcomings of MIP mapping. MIP mapping assumes that both the u and v components of the texture index are undergoing a uniform scaling, while in fact the terms du/dt and dv/dt are relatively independent. Thus, we must make some sort of compromise. Two of the most common approaches are given below:
55
![Page 56: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/56.jpg)
Anisotropy & MIP-Mapping • What happens when the surface is tilted?
MIP Mapped (Bi-Linear) Nearest Neighbor
56
![Page 57: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/57.jpg)
• Isotropic filter wrt screen space • Becomes anisotropic in texture
space • e.g. use anisotropic Gaussian • Called Elliptical Weighted
Average (EWA)
Elliptical weighted average
57
© source unknown. All rights reserved. This content is excluded from our CreativeCommons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.
![Page 58: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/58.jpg)
Image Quality Comparison • Trilinear mipmapping
EWA trilinear mipmapping
58
![Page 59: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/59.jpg)
Approximation of anisotropic • Feline: Fast Elliptical Lines for Anisotropic Texture Mapping Joel
McCormack, Ronald Perry, Keith I. Farkas, and Norman P. Jouppi SIGGRAPH 1999
• Andreas Schilling, Gunter Knittel & Wolfgang Strasser. Texram: A Smart Memory for Texturing. IEEE Computer Graphics and Applications, 16(3): 32-41, May 1996.
• Approximate Anisotropic Gaussian by a set of isotropic “probes”
59
© source unknown. All rights reserved. This content is excluded from our CreativeCommons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.
![Page 60: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/60.jpg)
FELINE results
60
© source unknown. All rights reserved. This content is excluded from our CreativeCommons license. For more information, see http://ocw.mit.edu/help/faq-fair-use/.
![Page 61: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/61.jpg)
Questions?
61
![Page 62: Sampling, Aliasing, and Mipmaps - MIT OpenCourseWare · –In the case of audio, people first include an analog low-pass filter before sampling –For ray tracing/rasterization: compute](https://reader033.vdocuments.mx/reader033/viewer/2022050508/5f99329e33be2c18820ce5e0/html5/thumbnails/62.jpg)
MIT OpenCourseWarehttp://ocw.mit.edu
6.837 Computer Graphics Fall 2012
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.