Unformatted text preview: CAP4730: Computational Structures in
Computer Graphics Antialiasing
What is antialiasing?
s How do we see the affects of antialiasing?
s What can we do about it?
s Math behind antialiasing
s Antialiasing in modern day graphics cards
s Advanced stuff on AA
s Let’s Revisit a pixel
Let’s Revisit a pixel
s A pixel is which of these things (theoretically)?
– has area
– has a location
– sample White Picket Fence
White Picket Fence
s What happens when we back away?
– 1: with a camera /eye
– 2: with OpenGL
– 3: with ray
tracing s s What’s the cause of the difference?
A pixel could be too BIG! A New Thought about Images
A New Thought about Images
s s s Images are really a 2D function
Here’s an image plotted as a height field
Now we store this image as an “array” of points. What does that mean? We Sample the Image We Sample the Image Function
s Here is the sampling function. It is called the delta function Thus we are “sampling” a Thus we are “sampling” a continuous image function
s s s s s We call these samples at this regular grid of points, pixels.
Pixels are a sampling of the function that describes the image.
We store these pixels into memory as an array of colors.
How densely should we sample?
What would govern this? Samples
s s s
s s s Continuous function with values at any input. Most things in the world. Ex. sine and cosine
Discrete function with values only at specific inputs. Computers are discrete. What is a 1D example? a 2D example?
To convert from a continuous function to a discrete one, we discretize or sample
To convert form a continuous variable to a discrete one, we quantize
When we render an image (which is a continuous function, why?), we sample and quantize Let’s get grounded with an Let’s get grounded with an example Similar examples?
s High frequency information, low sampling.
– Examples? Train comes every 2 hours. You go every 2:15. How long do you wait?
s Audio. 44/48 Khz signal. 11 Khz Sample
s – What is the result?
s 8 MP vs 4 MP vs 640 x 480 A quick footnote into A quick footnote into frequency analysis
s s A way to understand the sampling question is to convert the function into a different “space” or domain. We use the Fourier Transform to convert the function (in our case the image) into the frequency domain. What does sampling mean?
What does sampling mean?
s What happens if we don’t sample enough? Aliasing
s If we sample at too low a rate, the high frequencies in the image appear as lower frequencies.
How do we fix it?
Remove high frequencies Aliasing Aliasing Manifestations
s s Pixels approximating a signal Pixels aren’t small enough and MISS information Aliasing
s Aliasing manifests itself as “jaggies” in graphics. Thus we don’t have enough pixels to accurately represent the underlying function. Check out what happens when we increase our sampling. Aliasing
s Aliasing also manifests itself in repeating patterns
Big picture: – Continuous signal
– Discrete sampling (pixels, frames, etc.)
– Aliasing represents misrepresentation (hence the name) involved s How do we fix it? Fixing Aliasing
s What’s wrong with this approach?
s Filtering is another possibility
s – We want to remove the high frequency areas
– How would we do that? s Let’s reexamine what a pixel is in reality. Pixels are points
Pixels are points
s s But when we display the points, what happens?
Each pixel is actually a “blob” on the CRT. This blob has energy that falls off close to a Gaussian.
Thus the CRT has a built in “blurring” system. Think about how this works with resolution of your monitor. Let’s recall
2 1 (0,0) (4,0) 0
0 1 2 3 4 Point Sampling
s s s Thus for each pixel, we are “sampling” a specific point. In the frequency domain we get:
To convert from frequency to spatial domains, we do an integration.
To get around point sampling we should come up with another sampling technique BiLinear Sampling
What we will do is use a bilinear filter.
s This reduces the high frequencies (which cause aliasing)
s Interpolate between samples.
s BiLinear Sampling
BiLinear Sampling What are we doing?
What are we doing? (4,2) 2 1 (0,0)
0 1 2 3 4 Blurring
s s s s Remember, blurring removes high frequencies, which cause aliasing.
We can do other filtering besides bilinear, and we would like to to avoid artifacts.
How would we blur using our traditional graphics pipeline? Two ways to Antialias
Two ways to Antialias
s Increase resolution (increase sampling)
– or s Supersampling Increase Rendering Increase Rendering Resolution
s s Render the image at a higher resolution and downsample.
Really, you are letting your eye do some filtering for you. Supersampling
s 1 For each pixel, we would like to figure out what “percentage” is covered. (0,0)
0 1 2 3 4 Supersampling
s For each pixel, sample at multiple points. – What is the distribution of these points?
s How many?
s How far away from center should I try?
s – How would I program this? Line Antialiasing
Line Antialiasing Full Screen Antialiasing
Full Screen Antialiasing
s s s s
s Another way to do the supersampling is to do full screen antialiasing
We want to draw the image with several camera jitter positions and average the answers
Can you see why this would give us near similar answers?
That’s what they mean by 2tap, 4tap antialiasing
What does this require?
– Computationwise s How would you implement this? Full Screen Antialiasing Full Screen Antialiasing Example (Exaggerated) Antialiasing in OpenGL
Antialiasing in OpenGL
s To do this in OpenGL, use the Accumulation buffer – glAccum(GL_ACCUM, FRAMES_TO_AVERAGE);
– glAccum(GL_LOAD, 1);
– glAccum(GL_RETURN); s s VERY SLOW! What does this mean memory wise?
Other approahces: graphics cards, quincux Aliasing Examples
s From: http://www.os2ezine.
html Hardware Antialiasing
s s s Don’t just generate 1 answer to write to a pixel
nVidia Quincunx AA (2000 – GeForce3)
Result Results from Results from http://www.techreport.com/etc/2005q3/sli
Difference OpenGL Antialiasing
s Points and Lines – glEnable(GL_POINT_SMOOTH);
– glEnable(GL_LINE_SMOOTH); s Triangles – glEnable(GL_POLYGON_SMOOTH);
s Provides blend alpha at edges of a triangle ...
View Full Document
This note was uploaded on 11/30/2011 for the course CIS 4930 taught by Professor Staff during the Fall '08 term at University of Florida.
- Fall '08
- Computer Graphics