CS 445 / CS 645 Antialiasing Today • Final Exam – Thursday, December 13th at 7:00 • Project 4-1 Out • Movies.

Download Report

Transcript CS 445 / CS 645 Antialiasing Today • Final Exam – Thursday, December 13th at 7:00 • Project 4-1 Out • Movies.

CS 445 / CS 645
Antialiasing
Today
• Final Exam
– Thursday, December 13th at 7:00
• Project 4-1 Out
• Movies
Samples
Sampling Errors
• Some objects missed entirely, others
poorly sampled
Supersampling
• Take more than one sample for each pixel
and combine them
•
•
•
•
Do you actually render more pixels?
Can you combine the few pixels you have?
How many samples is enough?
How do we know no features are lost?
Unweighted Area Sampling
• Average supersampled points
• All points are weighted equally
Weighted Area Sampling
• Points in pixel are weighted differently
– Flickering occurs as object moves
across display
• Overlapping regions eliminates flicker
How is this done today?
Full Screen Antialiasing
• Nvidia GeForce2
– OpenGL: scale image 400% and supersample
– Direct3D: scale image 400% - 1600%
• 3Dfx Multisampling
– 2- or 4-frame shift and average
• Nvidia GeForce3
– Multisampling but with fancy overlaps
• ATI SmoothVision
– Programmer selects samping pattern
GeForce3
• Multisampling
– After each pixel is rendered, write pixel
value to two different places in frame buffer
GeForce3 - Multisampling
• After rendering two copies of entire frame
– Shift pixels of Sample #2 left and up by ½ pixel
– Imagine laying Sample #2 (red) over Sample #1
(black)
GeForce3 - Multisampling
• Resolve the two samples into one
image by computing average between
each pixel from Sample 1 (black) and
the four pixels from
Sample 2 (red) that
are 1/ sqrt(2) pixels
away
GeForce3 - Multisampling
• No AA
Multisampling
GeForce3 - Multisampling
• 4x Supersample
Multisampling
Signal Theory
• Convert spatial signal to frequency
domain
Signal Theory
• Represent spatial
signal as sum of
sine waves
(varying amplitude
and phase shift)
Fourier Analysis
• Convert spatial domain to frequency
domain
– U is a complex number representing
amplitude and phase shift
– i = sqrt (-1)
Fourier Transform
• Examples of
spatial and
frequency
domains
Nyquist Rate
• The lower bound on the sampling rate
equals twice the highest frequency
component in the image’s spectrum
• This lower bound is the Nyquist Rate
Flaws with Nyquist Rate
• Samples may not align with peaks
Flaws with Nyquist Rate
• When sampling below Nyquist Rate,
resulting signal looks like a lowerfrequency one
Sampling in the Frequency
Domain
• Remember, sampling was defined as
multiplying a grid of delta functions by
the continuous image
• This is called a convolution in frequency
domain
The sampling grid
The function being
sampled
Convolution
• This amounts to accumulating copies of
the function’s spectrum sampled at the
delta functions of the sampling grid
Filtering
• To lower Nyquist rate, remove high
frequencies from image: low-pass filter
– Only low frequencies remain
• Sinc function is common filter:
– sinc(x) = sin (px)/px
Spatial Domain
Frequency Domain
Sinc Filter
• Slide filter along
spatial domain
and compute
new pixel value
that results
from
convolution
Bilinear Filter
• Sometimes called a tent filter
• Easy to compute
– just linearly interpolate between samples
• Finite extent and no negative values
• Still has artifacts
Sampling Pipeline