Presentation is loading. Please wait.

Presentation is loading. Please wait.

Antialiasing. What is alias? Alias - A false signal in telecommunication links from beats between signal frequency and sampling frequency (from dictionary.com)

Similar presentations


Presentation on theme: "Antialiasing. What is alias? Alias - A false signal in telecommunication links from beats between signal frequency and sampling frequency (from dictionary.com)"— Presentation transcript:

1 Antialiasing

2 What is alias? Alias - A false signal in telecommunication links from beats between signal frequency and sampling frequency (from dictionary.com) Not just telecommunication, alias is everywhere in computer graphics because rendering is essentially a sampling process Examples: Jagged edges False texture patterns

3 Rendering is a sampling process? Yes indeed. Image display example

4 Rendering is a sampling process? Another example Render a smooth surface

5 Ssignal sampling and filtering Two important steps when information are represented digitally: sampling and reconstruction Alias can be caused by any of the steps

6 Alias caused by under-sampling Have you ever looked at an electric fan and found it is rotated in a reverse direction? Sample at only ¼ of the frequency Incorrect result is seen !! - under-sampling problem

7 Alias caused by under-sampling 1D signal sampling example Actual signal Sampled signal

8 How often is enough? What is the right sampling frequency? Sampling theorem (or Nyquist limit) - the sampling frequency has to be at least twice the maximum frequency of the signal to be sampled Need two samples in this cycle www.microsoft.ca

9 Can alias be totally avoided Given the sampling theorem by Nyquist ? Not really – this is because the maximum frequency might be infinite, i.e., not bandlimited Most of graphics scenes are not bandlimited: sharp edges can never be completely sampled in a discrete manner (point sampling) We will talk about what we can do to correct alias for real time graphics

10 Strobe light on dripping water: Temporal aliasing Spokes on a rotating wheel: Temporal aliasing Moiré patterns: Spatial aliasing Examples of Aliasing

11 Antialiasing Lines Idea: Make line “fatter” Fade line out (removes high frequencies) Now sample the line

12 Antialiasing Lines Solution 1 – Unweighted Area Sampling: Treat line as a single-pixel wide rectangle Color pixels according to the percentage of each pixel that is “covered” by the rectangle

13 Solution 1: Unweighted Area Sampling Pixel area is unit square Constant weighting function Pixel color is determined by computing the amount of the pixel covered by the line, then shading accordingly Easy to compute, gives reasonable results Line One Pixel

14 Solution 2: Weighted Area Sampling  Treat pixel area as a circle with a radius of one pixel  Use a radially symmetric weighting function (e.g., cone) : Areas closer to the pixel center are weighted more heavily  Better results than unweighted, slightly higher cost Line One Pixel

15 Solution 3: Super-sampling Divide pixel up into “sub-pixels”: 2  2, 3  3, 4  4, etc. Sub-pixel is colored if inside line Pixel color is the average of its sub-pixel colors Easy to implement (in software and hardware) Expensive No antialiasingAntialiasing (2  2 super-sampling)

16 Different Supersampling Schemes The common formula: c(i,x,y): color of the ith sample for pixel(x,y) ; Wi: weight Different super-sampling schemes

17 Reconstruction After the (ideal) sampling is done, we still need to reconstruct back the original continuous signal The reconstruction is done by reconstruction filter

18 Reconstruction Filters Common reconstruction filters: Box filter Tent filter Sinc filter = sin(  x)/  x

19 Box filter Very simple, but not very good

20 Tent Filter Based on linear interpolation. Better, but still not smooth

21 Sinc Filter Ideal low-pass filter

22 Anti-aliased texture mapping The above anti-aliasing methods work better for removing jagged edges but not texture aliasing Two problems to address – Magnification Minification

23 Re-sampling Minification and Magnification – resample the signal to a different resolution Magnification Minification (note the minification is done badly here)

24 Magnification Simpler to handle, just resample the reconstructed signal Reconstructed signal Resample the reconstructed signal

25 Magnification Common methods: nearest neighbor (box filter) or linear interpolation (tent filter) Nearest neighbor bilinear interpolation

26 Minification Harder to handle The signal’s frequency is too high to avoid aliasing A possible solution: Increase the low pass filter width of the ideal sinc filter – this effectively blur the image Blur the image first (using any method), and then sample it

27 Minification Several texels cover one pixel (under sampling happens) Under sample artifact one pixel Solution: Either increase sampling rate or reduce the texture Frequency We will discuss: 1.Mip-mapping 2.Rip-mapping 3.Sum Area Table

28 Mip-mapping By Lance Williams (SIGGRAPH ’83) Mip – many things in a small place The original texture is augmented with a set of low resolution textures Which resolution to use depends on the screen projection size – try to maintain pixel to texel ration close to 1 average 2x2 texels

29 Mipmapping problem Overblurring! – When a pixel covers many u texels but few v texels, we always choose the largest pixel coverage to decide the level Non mipmapping mipmapping

30 Ripmapping Correct the over-blurring problem of mipmapping – separating x and y filtering Scale by half by x across a row. Scale by half in y going down a column. The diagonal has the equivalent mip-map. Four times the amount of storage is required. Four different texel values to average ?

31 Summed Area Table Another way to perform anisotropic filtering - can be used to compute the average color for any arbitrary rectangular region in the texture space at a constant speed A two dimensional array that has the same size as the texture Every pixel stores the sum of all the texel colors in the lower left corner

32 Summed Area Table (SAT) How to calculate the sum of texels in the area between A and B? R A B C D R = SAT[B] – SAT[C] – SAT[D] + SAT[A] The average value can be computed by R / num of texels in R

33 Summed Area Table (SAT) is used to filter the texture Compute the rectangular bounding box of the pixel area in the texture and then use summed area table to compute the average color (i.e., filter the texels when magnification takes place) pixel polygon Texture space x y

34 Summed Area Table Less blurry than Mipmapping Still blurry when the texture is viewed along its diagonal – the bounding box of the pixel area is larger than the actual pixel area pixel polygon Texture space x y not quit fit

35 Comparison Non filtering Mipmapping Summed area table Note that only mipmap is implemented by hardware and supported by OpenGL

36 Motion Blur – Temporal Antialias Tricky Simplest Solution: supersampling in time brute force approach motion blur increases temporal resolution Just as pixel antialiasing increases spatial resolution If an object moves 16 pixels in one frame, then 16 supersample images (or even less) should be adequate


Download ppt "Antialiasing. What is alias? Alias - A false signal in telecommunication links from beats between signal frequency and sampling frequency (from dictionary.com)"

Similar presentations


Ads by Google