David Luebke 1 4/28/2015 Aliasing & Antialiasing.

Slides:



Advertisements
Similar presentations
Sampling, Aliasing.
Advertisements

Sampling and Reconstruction
Technische Universität München Fakultät für Informatik Computer Graphics SS 2014 Sampling Rüdiger Westermann Lehrstuhl für Computer Graphik und Visualisierung.
Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.
David Luebke1/19/99 CS 551/651: Antialiasing David Luebke
CS 551 / CS 645 Antialiasing. What is a pixel? A pixel is not… –A box –A disk –A teeny tiny little light A pixel is a point –It has no dimension –It occupies.
Aliasing & Antialiasing
Sampling, Aliasing, & Mipmaps
CSCE 641 Computer Graphics: Image Sampling and Reconstruction Jinxiang Chai.
CSCE 641 Computer Graphics: Image Sampling and Reconstruction Jinxiang Chai.
Immagini e filtri lineari. Image Filtering Modifying the pixels in an image based on some function of a local neighborhood of the pixels
Advanced Computer Graphics (Spring 2006) COMS 4162, Lecture 3: Sampling and Reconstruction Ravi Ramamoorthi
CS5520 Image-Based Rendering © Chun-Fa Chang, Spring 2003 Sampling Theorem & Antialiasing April 15, 2003.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Sampling Week 7, Fri 17 Oct 2003 p1 demos sampling.
CPSC 641 Computer Graphics: Fourier Transform Jinxiang Chai.
Aliasing and Anti-Aliasing Copyright Zachary Wartell, University of North Carolina at Charlotte, All Rights Reserved Revision: 10/24/2007 3:38:00 AM ©Zachary.
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 3: Sampling and Reconstruction Ravi Ramamoorthi
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
Linear Filtering About modifying pixels based on neighborhood. Local methods simplest. Linear means linear combination of neighbors. Linear methods simplest.
09/18/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Bump Mapping Multi-pass algorithms.
02/12/02 (c) 2002 University of Wisconsin, CS 559 Filters A filter is something that attenuates or enhances particular frequencies Easiest to visualize.
Sampling and Antialiasing CMSC 491/635. Abstract Vector Spaces Addition –C = A + B = B + A –(A + B) + C = A + (B + C) –given A, B, A + X = B for only.
Advanced Computer Graphics CSE 190 [Spring 2015], Lecture 3 Ravi Ramamoorthi
Filtering theory: Battling Aliasing with Antialiasing Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
CS 431/636 Advanced Rendering Techniques
© Chun-Fa Chang Sampling Theorem & Antialiasing. © Chun-Fa Chang Motivations “ My ray traced images have a lot more pixels than the TV screen. Why do.
Antialiasing CptS 548 Advanced Computer Graphics John C. Hart.
Attributes of Graphics Primitives Sang Il Park Sejong University.
David Luebke 1 9/4/2015 CS 551/651: Advanced Computer Graphics Antialiasing Continued: Prefiltering and Supersampling.
Computer Graphics Inf4/MSc Computer Graphics Lecture 9 Antialiasing, Texture Mapping.
Antialiasing CAP4730: Computational Structures in Computer Graphics.
CSC418 Computer Graphics n BSP tree n Z-Buffer n A-buffer n Scanline.
10/26/04© University of Wisconsin, CS559 Fall 2004 Last Time Drawing lines Polygon fill rules Midterm Oct 28.
Filtering Robert Lin April 29, Outline Why filter? Filtering for Graphics Sampling and Reconstruction Convolution The Fourier Transform Overview.
Multimedia Data Introduction to Image Processing Dr Sandra I. Woolley Electronic, Electrical.
CS 450: COMPUTER GRAPHICS ANTIALIASING SPRING 2015 DR. MICHAEL J. REALE.
Week 6 - Wednesday.  What did we talk about last time?  Light  Material  Sensors.
Image Processing Basics. What are images? An image is a 2-d rectilinear array of pixels.
Lecture Fall 2001 From S. Zeki, Inner Vision.
CMSC 635 Sampling and Antialiasing. Aliasing in images.
Digital Image Processing Lecture 10: Image Restoration
David Luebke 1 12/2/2015 CS 551/651: Advanced Computer Graphics Advanced Ray Tracing Radiosity.
Sang Il Park Sejong University
Duy & Piotr. How to reconstruct a high quality image with the least amount of samples per pixel the least amount of resources And preserving the image.
GG313 Lecture 24 11/17/05 Power Spectrum, Phase Spectrum, and Aliasing.
Lecture 6 Rasterisation, Antialiasing, Texture Mapping,
Sampling Pixel is an area!! – Square, Rectangular, or Circular? How do we approximate the area? – Why bother? Color of one pixel Image Plane Areas represented.
2D Sampling Goal: Represent a 2D function by a finite set of points.
Single Pass Point Rendering and Transparent Shading Paper by Yanci Zhang and Renato Pajarola Presentation by Harmen de Weerd and Hedde Bosman.
Sampling Theorem & Antialiasing
(c) 2002 University of Wisconsin, CS 559
CS559: Computer Graphics Lecture 12: Antialiasing & Visibility Li Zhang Spring 2008.
01/26/05© 2005 University of Wisconsin Last Time Raytracing and PBRT Structure Radiometric quantities.
David Luebke 3/17/2016 Advanced Computer Graphics Antialiasing David Luebke
COMPUTER GRAPHICS CS 482 – FALL 2015 NOVEMBER 10, 2015 VISIBILITY CULLING HIDDEN SURFACES ANTIALIASING HALFTONING.
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
Sampling Week 7, Fri 17 Oct 2003 p1 demos sampling.
Advanced Computer Graphics
… Sampling … … Filtering … … Reconstruction …
Distributed Ray Tracing
Sampling Theorem & Antialiasing
(C) 2002 University of Wisconsin, CS 559
Sampling and Antialiasing
Sampling Theorem told us …
Joshua Barczak CMSC435 UMBC
CSCE 643 Computer Vision: Image Sampling and Filtering
Distributed Ray Tracing
Filtering Images Work in the spatial domain
Distributed Ray Tracing
Color Perception of color Color spaces
Presentation transcript:

David Luebke 1 4/28/2015 Aliasing & Antialiasing

David Luebke 2 4/28/2015 Recap: Aliasing ● Sampling a function = multiplying I(x) by sampling fn S x = convolving F(u) by sampling fn S 1/x = copying F(u) at regular intervals ● If the copies of F(u) overlap, high frequencies “fold over”, appearing as lower frequencies ● This is known as aliasing

David Luebke 3 4/28/2015 Prefiltering ● Eliminate high frequencies before sampling (Foley & van Dam p. 630) ■ Convert I(x) to F(u) ■ Apply a low-pass filter (e.g., multiply F(u) by a box function) ■ Then sample. Result: no aliasing! ● So what’s the problem?

David Luebke 4 4/28/2015 Prefiltering ● Eliminate high frequencies before sampling (Foley & van Dam p. 630) ■ Convert I(x) to F(u) ■ Apply a low-pass filter (e.g., multiply F(u) by a box function) ■ Then sample. Result: no aliasing! ● Problem: most rendering algorithms generate sampled function directly ■ e.g., Z-buffer, ray tracing

David Luebke 5 4/28/2015 Supersampling ● The simplest way to reduce aliasing artifacts is supersampling ■ Increase the resolution of the samples ■ Average the results down ● Sometimes called postfiltering ■ Create virtual image at higher resolution than the final image ■ Apply a low-pass filter ■ Resample filtered image

David Luebke 6 4/28/2015 Supersampling: Limitations ● Q: What practical consideration hampers supersampling? ● A: Storage goes up quadratically ● Q: What theoretical problem does supersampling suffer? ● A: Doesn’t eliminate aliasing! Supersampling simply shifts the Nyquist limit higher

David Luebke 7 4/28/2015 Supersampling: Worst Case ● Q: Give a simple scene containing infinite frequencies ● A: A checkered ground plane receeding into infinity ● Show Watt & Watt, Figure 4.9

David Luebke 8 4/28/2015 Supersampling ● Despite these limitations, people still use supersampling (why?) ● So how can we best perform it?

David Luebke 9 4/28/2015 Supersampling ● The process: ■ Create virtual image at higher resolution than the final image ■ Apply a low-pass filter ■ Resample filtered image

David Luebke 10 4/28/2015 Supersampling ● Create virtual image at higher resolution than the final image ■ This is easy

David Luebke 11 4/28/2015 Supersampling ● Apply a low-pass filter ■ Convert to frequency domain ■ Multiply by a box function ● Expensive! Can we simplify this? ■ Recall: multiplication in frequency equals convolution in space, so… ■ Just convolve initial sampled image with the FT of a box function ■ Isn’t this a lot of work?

David Luebke 12 4/28/2015 Supersampling: Digital Convolution ● In practice, we combine steps 2 & 3: ■ Create virtual image at higher resolution than the final image ■ Apply a low-pass filter ■ Resample filtered image ● Idea: only create filtered image at new sample points ■ I.e., only convolve filter with image at new points

David Luebke 13 4/28/2015 Supersampling: Digital Convolution ● Q: What does convolving a filter with an image entail at each sample point? ● A: Multiplying and summing values ● Example (also F&vD p 642):  = = …

David Luebke 14 4/28/2015 Supersampling ● Q: What filter should we use in space to effect multiplying by a box function in frequency? ● A: The sinc function (sin(x) / x) ● Q: Why is this hard? ■ Sinc function has infinite support ■ Sinc function has negative lobes

David Luebke 15 4/28/2015 Supersampling ● Common filters: ■ Truncated sinc ■ Box ■ Triangle ■ Guassian ● What do the frequency spectra of each of these filters look like? ● A: see F&vD, p

David Luebke 16 4/28/2015 Supersampling ● Typical supersampling algorithm: ■ Compute multiple samples per pixel ■ Combine sample values for pixel’s value using simple average ● Q: What filter does this equate to? ● A: Box filter -- one of the worst! ● Q: What’s wrong with box filters? ■ Passes infinitely high frequencies ■ Attenuates desired frequencies

David Luebke 17 4/28/2015 Supersampling In Practice ● Sinc function: ideal but impractical ● One approximation: sinc 2 (=what?) ● Another: Guassian falloff ● Q: How wide (what res) should filter be? ● A: As wide as possible (duh) ● In practice: 3x3, 5x5, at most 7x7

David Luebke 18 4/28/2015 Supersampling: Summary ● Supersampling improves aliasing artifacts by shifting the Nyquist limit ● It works by calculating a high-res image and filtering down to final res ● “Filtering down” means simultaneous convolution and resampling ● This equates to a weighted average ● Wider filter  better results  more work

David Luebke 19 4/28/2015 Summary So Far ● Prefiltering ■ Before sampling the image, use a low-pass filter to eliminate frequencies above the Nyquist limit ■ This blurs the image… ■ But ensures that no high frequencies will be misrepresented as low frequencies

David Luebke 20 4/28/2015 Summary So Far ● Supersampling ■ Sample image at higher resolution than final image, then “average down” ■ “Average down” means multiply by low-pass function in frequency domain ■ Which means convolving by that function’s FT in space domain ■ Which equates to a weighted average of nearby samples at each pixel

David Luebke 21 4/28/2015 Summary So Far ● Supersampling cons ■ Doesn’t eliminate aliasing, just shifts the Nyquist limit higher ○ Can’t fix some scenes (e.g., checkerboard) ■ Badly inflates storage requirements ● Supersampling pros ■ Relatively easy ■ Often works all right in practice ■ Can be added to a standard renderer

David Luebke 22 4/28/2015 Antialiasing in the Continuous Domain ● Problem with prefiltering: ■ Sampling and image generation inextricably linked in most renderers ○ Z-buffer algorithm ○ Ray tracing ■ Why? ● Still, some approaches try to approximate effect of convolution in the continuous domain

David Luebke 23 4/28/2015 Antialiasing in the Continuous Domain Pixel Grid Polygons Filter kernel

David Luebke 24 4/28/2015 Antialiasing in the Continuous Domain ● The good news ■ Exact polygon coverage of the filter kernel can be evaluated ■ What does this entail? ○ Clipping ○ Hidden surface determination

David Luebke 25 4/28/2015 Antialiasing in the Continuous Domain ● The bad news ■ Evaluating coverage is very expensive ■ The intensity variation is too complex to integrate over the area of the filter ○ Q: Why does intensity make it harder? ○ A: Because polygons might not be flat- shaded ○ Q: How bad a problem is this? ○ A: Intensity varies slowly within a pixel, so shape changes are more important

David Luebke 26 4/28/2015 Catmull’s Algorithm ABAB A1A1 A2A2 A3A3 ● Find fragment areas ● Multiply by fragment colors ● Sum for final pixel color

David Luebke 27 4/28/2015 Catmull’s Algorithm ● First real attempt to filter in continuous domain ● Very expensive ■ Clipping polygons to fragments ■ Sorting polygon fragments by depth (What’s wrong with this as a hidden surface algorithm?) ● Equates to box filter (Is that good?)

David Luebke 28 4/28/2015 The A-Buffer ● Idea: approximate continuous filtering by subpixel sampling ● Summing areas now becomes simple

David Luebke 29 4/28/2015 The A-Buffer ● Advantages: ■ Incorporating into scanline renderer reduces storage costs dramatically ■ Processing per pixel depends only on number of visible fragments ■ Can be implemented efficiently using bitwise logical ops on subpixel masks

David Luebke 30 4/28/2015 The A-Buffer ● Disadvantages ■ Still basically a supersampling algorithm ■ Not a hardware-friendly algorithm ○ Lists of potentially visible polygons can grow without limit ○ Work per-pixel non-deterministic

David Luebke 31 4/28/2015 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

David Luebke 32 4/28/2015 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

David Luebke 33 4/28/2015 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!

David Luebke 34 4/28/2015 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

David Luebke 35 4/28/2015 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

David Luebke 36 4/28/2015 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

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

David Luebke 38 4/28/2015 Stochastic Sampling ● Poisson distribution: ■ Completely random ■ Add points at random until area is full. ■ Uniform distribution: some neighboring samples close together, some distant

David Luebke 39 4/28/2015 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

David Luebke 40 4/28/2015 Stochastic Sampling ● Jittered distribution ■ Start with regular grid of samples ■ Perturb each sample slightly in a random direction ■ More “clumpy” or granular in appearance

David Luebke 41 4/28/2015 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.

David Luebke 42 4/28/2015 Stochastic Sampling ● Watt & Watt, p. 134 ● See Foley & van Dam, p