Aliasing and Antialiasing
Total Page:16
File Type:pdf, Size:1020Kb
Aliasing and Antialiasing What is Aliasing? “Errors and Artifacts arising during rendering, due to the conversion from a continuously defined illumination field to a discrete raster grid of pixels” ITCS 4120/5120 1 Aliasing and Antialiasing ITCS 4120/5120 2 Aliasing and Antialiasing What is Aliasing? What is Aliasing? ITCS 4120/5120 3 Aliasing and Antialiasing ITCS 4120/5120 4 Aliasing and Antialiasing What is Aliasing? Effects of Aliasing ITCS 4120/5120 5 Aliasing and Antialiasing ITCS 4120/5120 6 Aliasing and Antialiasing Effects of Aliasing Effects of Aliasing ITCS 4120/5120 7 Aliasing and Antialiasing ITCS 4120/5120 8 Aliasing and Antialiasing Effects of Aliasing Anti-aliasing ITCS 4120/5120 9 Aliasing and Antialiasing ITCS 4120/5120 10 Aliasing and Antialiasing Area Sampling Techniques Anti-aliasing Techniques Prefiltering (unweighted/weighted area sampling) Postfiltering (supersampling, jittering) ITCS 4120/5120 11 Aliasing and Antialiasing ITCS 4120/5120 12 Aliasing and Antialiasing Area Sampling Techniques Area Sampling Techniques ITCS 4120/5120 13 Aliasing and Antialiasing ITCS 4120/5120 14 Aliasing and Antialiasing Area Sampling Techniques Area Sampling Techniques ITCS 4120/5120 15 Aliasing and Antialiasing ITCS 4120/5120 16 Aliasing and Antialiasing Unweighted Area Sampling Pixel intensity is varied in proportion to the area of the pixel inter- cepted by the primitive. Unweighted – equivalent to a box filter of unit height over pixel. Weighted Area Sampling Equal areas can contribute unequally in terms of pixel intensity. Areas closer to the pixel center contribute more. Essentially results in filtering with a mask that is centered over the Properties pixel with decreasing radial influence. Intensity of pixel decreases as the distance between the pixel center Cone filters are a compromise between computational expense and and primitive increases. optimality. A primitive cannot influence a pixel’s intensity if it does not intersect it. Equal areas (intersected) contribute equal intensity – not a desirable property. ITCS 4120/5120 17 Aliasing and Antialiasing ITCS 4120/5120 18 Aliasing and Antialiasing Postfiltering Techniques Supersampling (Regular Sampling) Very expensive. Not very satisfactory. ITCS 4120/5120 19 Aliasing and Antialiasing ITCS 4120/5120 20 Aliasing and Antialiasing Regular vs. Jittered Sampling Filtering ITCS 4120/5120 21 Aliasing and Antialiasing ITCS 4120/5120 22 Aliasing and Antialiasing Filtering Filtering Example ITCS 4120/5120 23 Aliasing and Antialiasing ITCS 4120/5120 24 Aliasing and Antialiasing Filtering Example Filtering Example ITCS 4120/5120 25 Aliasing and Antialiasing ITCS 4120/5120 26 Aliasing and Antialiasing Filtering Example Aliasing from a Sampling Theory Viewpoint Sampling(Spatial Domain) ITCS 4120/5120 27 Aliasing and Antialiasing ITCS 4120/5120 28 Aliasing and Antialiasing Frequency Domain X axis (position): frequency Y axis (height): strength of each frequency Sampling(Spatial Domain) Examples: sine wave: impulse, square wave: infinite train of im- pulses Image is a spatial signal ITCS 4120/5120 29 Aliasing and Antialiasing ITCS 4120/5120 30 Aliasing and Antialiasing What does the Fourier Transform Do to A How do we get to the Frequency Domain? Spatial Signal? Use the Fourier Transform Let φ(x) be a continuous function of a real variable x. Then ∞ j2πωx φ(x) = φ(ω) = φ(x)e− dx ={ } Z−∞ is the Fourier Transform of φ(x), with j = √ 1 and, − 1 ∞ j2πωx − φ(ω) = φ(x) = φ(ω)e dω = { } Z−∞ is the Inverse Fourier Transform. φ(x) is continuous and integrable ◦ φ(ω) is integrable ◦ x (spatial domain), ω (frequency domain) ◦ ITCS 4120/5120 31 Aliasing and Antialiasing ITCS 4120/5120Signal in frequency domain is an32 integration of individualAliasing sinusoids. and Antialiasing ◦ How does this related to Graphics? Sampling Theorem “Continuous-time signal can be completely recovered from its sam- ples iff the sampling rate is greater than twice the maximum fre- quency present in the signal.” — Claude Shannon Also known as the Nyquist rate ◦ Images are just a 2D signal and jagged edges are due to the pixel ◦ sampling rate not being high enough to capture the “real signal. ITCS 4120/5120 33 Aliasing and Antialiasing ITCS 4120/5120 34 Aliasing and Antialiasing Nyquist Rate Nyquist Rate:Undersampling The lower signal is undersampled and results in an aliased wave (dotted curve). ITCS 4120/5120 35 Aliasing and Antialiasing ITCS 4120/5120 36 Aliasing and Antialiasing Comb Function Comb Function(contd) Application: Used to digitize continuous functions. Multiplying f(x) with a comb in image space convolving their Fourier transforms, resulting in multiple identical⇐⇒ copies of f(x) Series of impulses (delta functions) ={ } Identity element of convolution: reproduces an indentical copy of the Can result in aliasing if copies overlap function f(x) Maximum allowable frequency is the Nyquist Frequency, which is FT of a comb function is another comb function half the sampling frequency. ITCS 4120/5120 37 Aliasing and Antialiasing ITCS 4120/5120 38 Aliasing and Antialiasing Reconstruction Example(Inadequate Sampling) Reconstruction Example(Adequate Sampling) ITCS 4120/5120 39 Aliasing and Antialiasing ITCS 4120/5120 40 Aliasing and Antialiasing Box Filter Pyramid Filter Reconstruction filter for nearest neighbor interpolation. Resampling images/volumes to a higher resolution using nearest Reconstruction filter used in linear interpolation neighbor values. Computationally more expensive, but more accurate sinπx FT of a box filter is the Sinc function ( ) πx FT is much better behaved (side lobes much smaller) Large side lobes continuing at regular intervals will cause aliasing. Less tendency to produce aliasing Aliasing in images manifests itself as “jaggies” ITCS 4120/5120 41 Aliasing and Antialiasing ITCS 4120/5120 42 Aliasing and Antialiasing Gaussian Filter The optimal filter in terms of avodiding side lobes FT of a Gaussian is another Gaussian Widely used to blur images and the basis for scale space ITCS 4120/5120 43 Aliasing and Antialiasing.