Presentation is loading. Please wait.

Presentation is loading. Please wait.

David Luebke 1 9/4/2015 CS 551/651: Advanced Computer Graphics Antialiasing Continued: Prefiltering and Supersampling.

Similar presentations


Presentation on theme: "David Luebke 1 9/4/2015 CS 551/651: Advanced Computer Graphics Antialiasing Continued: Prefiltering and Supersampling."— Presentation transcript:

1 David Luebke 1 9/4/2015 CS 551/651: Advanced Computer Graphics Antialiasing Continued: Prefiltering and Supersampling

2 David Luebke 2 9/4/2015 Recap: Antialiasing Strategies l Prefiltering: low-pass filter the signal before sampling n Pros: u Guaranteed to eliminate aliasing u Preserves all desired frequencies n Cons: u Expensive u Can introduce “ringing” u Doesn’t fit most rendering algorithms

3 David Luebke 3 9/4/2015 Recap: Antialiasing Strategies l Supersampling: sample at higher resolution, then filter down n Pros: u Conceptually simple u Easy to retrofit existing renderers u Works well most of the time n Cons: u High storage costs u Doesn’t eliminate aliasing, just shifts Nyquist limit upwards

4 David Luebke 4 9/4/2015 Recap: Antialiasing Strategies l A-Buffer: approximate prefiltering of continuous signal by sampling n Pros: u Integrating with scan-line renderer keeps storage costs low u Can be efficiently implemented with clever bitwise operations n Cons: u Still basically a supersampling approach u Doesn’t integrate with ray-tracing

5 David Luebke 5 9/4/2015 Stochastic Sampling l Sampling theory tells us that with a regular sampling grid, frequencies higher than the Nyquist limit will alias l Q: What about irregular sampling? l A: High frequencies appear as noise, not aliases l This turns out to bother our visual system less!

6 David Luebke 6 9/4/2015 Stochastic Sampling l An intuitive argument: n In stochastic sampling, every region of the image has a finite probability of being sampled n Thus small features that fall between uniform sample points tend to be detected by non-uniform samples

7 David Luebke 7 9/4/2015 Stochastic Sampling l Integrating with different renderers: n Ray tracing: u It is just as easy to fire a ray one direction as another n Z-buffer: hard, but possible u Notable example: REYES system (?) u Using image jittering is easier (more later) n A-buffer: nope u Totally built around square pixel filter and primitive-to- sample coherence

8 David Luebke 8 9/4/2015 Stochastic Sampling l Idea: randomizing distribution of samples scatters aliases into noise l Problem: what type of random distribution to adopt? l Reason: type of randomness used affects spectral characteristics of noise into which high frequencies are converted

9 David Luebke 9 9/4/2015 Stochastic Sampling l Problem: given a pixel, how to distribute points (samples) within it?

10 David Luebke 10 9/4/2015 Stochastic Sampling l Poisson distribution: n Completely random n Add points at random until area is full. n Uniform distribution: some neighboring samples close together, some distant

11 David Luebke 11 9/4/2015 Stochastic Sampling l Poisson disc distribution: n Poisson distribution, with minimum-distance constraint between samples n Add points at random, removing again if they are too close to any previous points n Very even-looking distribution

12 David Luebke 12 9/4/2015 Stochastic Sampling l Jittered distribution n Start with regular grid of samples n Perturb each sample slightly in a random direction n More “clumpy” or granular in appearance

13 David Luebke 13 9/4/2015 Stochastic Sampling l Spectral characteristics of these distributions: n Poisson: completely uniform (white noise). High and low frequencies equally present n Poisson disc: Pulse at origin (DC component of image), surrounded by empty ring (no low frequencies), surrounded by white noise n Jitter: Approximates Poisson disc spectrum, but with a smaller empty disc.

14 David Luebke 14 9/4/2015 Stochastic Sampling l Watt & Watt, p. 134 l See Foley & van Dam, p 644-645

15 David Luebke 15 9/4/2015 Nonuniform Supersampling l We’ve discussed two nonuniform sampling approaches n Adaptive supersampling: u Sample (say) once per pixel, then supersample if intensity changes a lot n Stochastic supersampling: u Use multiple samples per pixel, but not on a uniform grid l Can we filter nonuniform supersampled images?

16 David Luebke 16 9/4/2015 Nonuniform Supersampling l Recall: convolution I’ of filter h with image function I is given by: I’(x,y) =   I(i, j) h(x-i, y-j) l Can we use this equation for nonuniform sampling? l Implicit in this equation is a normalizing factor: we assume the filter weights sum to unity

17 David Luebke 17 9/4/2015 Nonuniform Supersampling Pixel

18 David Luebke 18 9/4/2015 Nonuniform Supersampling Sampling Grid

19 David Luebke 19 9/4/2015 Nonuniform Supersampling Polygon

20 David Luebke 20 9/4/2015 Nonuniform Supersampling Adaptive Sampling

21 David Luebke 21 9/4/2015 Nonuniform Supersampling Final Samples l Problem: n Many more purple samples than white samples n But final pixel actually more white than purple! n Simple filtering will not handle this correctly

22 David Luebke 22 9/4/2015 Nonuniform Supersampling l Approximate answer: weighted average filter n Divide total value of samples X filter by total value of filter at sample points:   I(i, j) h(x-i, y-j)   h(x-i, y-j) I’(x,y) =

23 David Luebke 23 9/4/2015 Nonuniform Supersampling l Correct answer: multistage filtering n Use weighted-average filters in cascade, sequentially applying filters with lower and lower cutoff frequencies

24 David Luebke 24 9/4/2015 Nonuniform Supersampling l Real-world answer: ignore the problem n Keep random components small compared to filter width n Use standard supersampling filter n Cook ‘87 (REYES) uses 4x4 jittered supersampling

25 David Luebke 25 9/4/2015 Antialiasing and Texture Mapping l We may want to apply antialiasing techniques to the texture mapping process separately from the rest of the rendering process l Why?

26 David Luebke 26 9/4/2015 Antialiasing and Texture Mapping l Texture mapping is uniquely harder n Coherent textures present pathological artifacts n Correct filter shape changes l Texture mapping is uniquely easier n Textures are known ahead of time n They can thus be prefiltered

27 David Luebke 27 9/4/2015 Antialiasing and Texture Mapping l More on texture problems n Coherent texture frequencies become infinitely high with increasing distance u Ex: checkerboard receding to horizon n Unfiltered textures lead to compression u Ex: pixel covers entire checkerboard u Unfiltered mapping: pixel is black or white u Moving checkerboard  flashing pixels

28 David Luebke 28 9/4/2015 Antialiasing and Texture Mapping l Problem: a square pixel on screen becomes a curvilinear quadrilateral in texture map (see W&W, p 140) l The coverage and area of this shape change as a function of the mapping l Most texture antialiasing algorithms approximate this shape somehow

29 David Luebke 29 9/4/2015 Recap: Antialiasing and Texture Mapping l Mip-mapping n MIP = Multim in Parvo (many things in a small place) n Ignores shape change of inverse pixel n But allows size to vary l Idea: store texture as a pyramid of progressively lower-resolution images, filtered down from original

30 David Luebke 30 9/4/2015 Antialiasing: Mip-Mapping Depth of Mip-Map

31 David Luebke 31 9/4/2015 G Antialiasing: Mip Mapping R B RG B RG B B GR

32 David Luebke 32 9/4/2015 Antialiasing: Mip Mapping l Distant textures use higher levels of the mipmap l Thus, the texture map is prefiltered l Thus, reduced aliasing!

33 David Luebke 33 9/4/2015 Antialiasing: Mip Mapping l Which level of mip-map to use? n Think of mip-map as 3-D pyramid n Index into mip-map with 3 coordinates: u, v, d (depth) l Q: What does d correspond to in the mip-map? l A: size of the filter

34 David Luebke 34 9/4/2015 Antialiasing: Mip Mapping l The size of the filter (i.e., d in the mip-map) depends on the pixel coverage area in the texture map n In general, treat d as a continuous value n Blend between nearest mip-map level using linear interpolation l Q: What is tri-linear interpolation?

35 David Luebke 35 9/4/2015 Antialiasing: Mip Mapping l Q: What’s wrong with the mip-map approach to prefiltering texture? l A: Assumes pixel maps to square in texture space l More sophisticated inverse pixel filters (see F&vD p 828): n Summed area tables n Elliptical weighted average filtering

36 David Luebke 36 9/4/2015 The End


Download ppt "David Luebke 1 9/4/2015 CS 551/651: Advanced Computer Graphics Antialiasing Continued: Prefiltering and Supersampling."

Similar presentations


Ads by Google