Top Banner
David Luebke 1 03/27/22 CS 551/651: Advanced Computer Graphics Antialiasing Continued: Prefiltering and Supersampling
36

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

Dec 26, 2015

Download

Documents

Sharlene Mason
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: David Luebke 1 9/4/2015 CS 551/651: Advanced Computer Graphics Antialiasing Continued: Prefiltering and Supersampling.

David Luebke 1 04/19/23

CS 551/651: Advanced Computer Graphics

Antialiasing Continued:

Prefiltering and Supersampling

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

David Luebke 2 04/19/23

Recap: Antialiasing Strategies

Prefiltering: low-pass filter the signal before sampling Pros:

Guaranteed to eliminate aliasing Preserves all desired frequencies

Cons: Expensive Can introduce “ringing” Doesn’t fit most rendering algorithms

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

David Luebke 3 04/19/23

Recap:Antialiasing Strategies

Supersampling: sample at higher resolution, then filter down Pros:

Conceptually simple Easy to retrofit existing renderers Works well most of the time

Cons: High storage costs Doesn’t eliminate aliasing, just shifts Nyquist limit

upwards

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

David Luebke 4 04/19/23

Recap:Antialiasing Strategies

A-Buffer: approximate prefiltering of continuous signal by sampling Pros:

Integrating with scan-line renderer keeps storage costs low

Can be efficiently implemented with clever bitwise operations

Cons: Still basically a supersampling approach Doesn’t integrate with ray-tracing

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

David Luebke 5 04/19/23

Stochastic Sampling

Sampling theory tells us that with a regular sampling grid, frequencies higher than the Nyquist limit will alias

Q: What about irregular sampling? A: High frequencies appear as noise, not

aliases This turns out to bother our visual system less!

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

David Luebke 6 04/19/23

Stochastic Sampling

An intuitive argument: In stochastic sampling, every region of the image

has a finite probability of being sampled Thus small features that fall between uniform

sample points tend to be detected by non-uniform samples

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

David Luebke 7 04/19/23

Stochastic Sampling

Integrating with different renderers: Ray tracing:

It is just as easy to fire a ray one direction as another Z-buffer: hard, but possible

Notable example: REYES system (?) Using image jittering is easier (more later)

A-buffer: nope Totally built around square pixel filter and primitive-to-

sample coherence

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

David Luebke 8 04/19/23

Stochastic Sampling

Idea: randomizing distribution of samples scatters aliases into noise

Problem: what type of random distribution to adopt?

Reason: type of randomness used affects spectral characteristics of noise into which high frequencies are converted

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

David Luebke 9 04/19/23

Stochastic Sampling

Problem: given a pixel, how to distribute points (samples) within it?

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

David Luebke 10 04/19/23

Stochastic Sampling

Poisson distribution: Completely random Add points at random until area is full. Uniform distribution: some neighboring samples

close together, some distant

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

David Luebke 11 04/19/23

Stochastic Sampling

Poisson disc distribution: Poisson distribution, with minimum-distance

constraint between samples Add points at random, removing again if they are

too close to any previous points Very even-looking distribution

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

David Luebke 12 04/19/23

Stochastic Sampling

Jittered distribution Start with regular grid of samples Perturb each sample slightly in a random direction More “clumpy” or granular in appearance

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

David Luebke 13 04/19/23

Stochastic Sampling

Spectral characteristics of these distributions: Poisson: completely uniform (white noise). High and low

frequencies equally present Poisson disc: Pulse at origin (DC component of image),

surrounded by empty ring (no low frequencies), surrounded by white noise

Jitter: Approximates Poisson disc spectrum, but with a smaller empty disc.

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

David Luebke 14 04/19/23

Stochastic Sampling

Watt & Watt, p. 134 See Foley & van Dam, p 644-645

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

David Luebke 15 04/19/23

Nonuniform Supersampling

We’ve discussed two nonuniform sampling approaches Adaptive supersampling:

Sample (say) once per pixel, then supersample if intensity changes a lot

Stochastic supersampling: Use multiple samples per pixel, but not on a uniform grid

Can we filter nonuniform supersampled images?

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

David Luebke 16 04/19/23

Nonuniform Supersampling

Recall: convolution I’ of filter h with image function I is given by:

I’(x,y) = I(i, j) h(x-i, y-j) Can we use this equation for nonuniform

sampling? Implicit in this equation is a normalizing

factor: we assume the filter weights sum to unity

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

David Luebke 17 04/19/23

Nonuniform Supersampling

Pixel

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

David Luebke 18 04/19/23

Nonuniform Supersampling

Sampling Grid

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

David Luebke 19 04/19/23

Nonuniform Supersampling

Polygon

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

David Luebke 20 04/19/23

Nonuniform Supersampling

Adaptive Sampling

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

David Luebke 21 04/19/23

Nonuniform Supersampling

Final Samples

Problem: Many more purple samples

than white samples But final pixel actually more

white than purple! Simple filtering will not handle

this correctly

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

David Luebke 22 04/19/23

Nonuniform Supersampling

Approximate answer: weighted average filter 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) =

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

David Luebke 23 04/19/23

Nonuniform Supersampling

Correct answer: multistage filtering Use weighted-average filters in cascade,

sequentially applying filters with lower and lower cutoff frequencies

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

David Luebke 24 04/19/23

Nonuniform Supersampling

Real-world answer: ignore the problem Keep random components small compared to filter

width Use standard supersampling filter Cook ‘87 (REYES) uses 4x4 jittered

supersampling

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

David Luebke 25 04/19/23

Antialiasing and Texture Mapping

We may want to apply antialiasing techniques to the texture mapping process separately from the rest of the rendering process

Why?

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

David Luebke 26 04/19/23

Antialiasing and Texture Mapping

Texture mapping is uniquely harder Coherent textures present pathological artifacts Correct filter shape changes

Texture mapping is uniquely easier Textures are known ahead of time They can thus be prefiltered

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

David Luebke 27 04/19/23

Antialiasing and Texture Mapping

More on texture problems Coherent texture frequencies become infinitely

high with increasing distance Ex: checkerboard receding to horizon

Unfiltered textures lead to compression Ex: pixel covers entire checkerboard Unfiltered mapping: pixel is black or white Moving checkerboard flashing pixels

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

David Luebke 28 04/19/23

Antialiasing and Texture Mapping

Problem: a square pixel on screen becomes a curvilinear quadrilateral in texture map (see W&W, p 140)

The coverage and area of this shape change as a function of the mapping

Most texture antialiasing algorithms approximate this shape somehow

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

David Luebke 29 04/19/23

Recap: Antialiasing and Texture Mapping

Mip-mapping MIP = Multim in Parvo (many things in a small

place) Ignores shape change of inverse pixel But allows size to vary

Idea: store texture as a pyramid of progressively lower-resolution images, filtered down from original

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

David Luebke 30 04/19/23

Antialiasing: Mip-Mapping

Depth of Mip-Map

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

David Luebke 31 04/19/23

GAntialiasing: Mip Mapping

RBR G

BR G

BB

GR

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

David Luebke 32 04/19/23

Antialiasing: Mip Mapping

Distant textures use higher levels of the mipmap

Thus, the texture map is prefiltered Thus, reduced aliasing!

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

David Luebke 33 04/19/23

Antialiasing: Mip Mapping

Which level of mip-map to use? Think of mip-map as 3-D pyramid Index into mip-map with 3 coordinates: u, v, d

(depth) Q: What does d correspond to in the mip-map? A: size of the filter

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

David Luebke 34 04/19/23

Antialiasing: Mip Mapping

The size of the filter (i.e., d in the mip-map) depends on the pixel coverage area in the texture map In general, treat d as a continuous value Blend between nearest mip-map level using linear

interpolation Q: What is tri-linear interpolation?

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

David Luebke 35 04/19/23

Antialiasing: Mip Mapping

Q: What’s wrong with the mip-map approach to prefiltering texture?

A: Assumes pixel maps to square in texture space

More sophisticated inverse pixel filters (see F&vD p 828): Summed area tables Elliptical weighted average filtering

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

David Luebke 36 04/19/23

The End