Pre-Filter Antialiasing Kurt Akeley CS248 Lecture 4 4 October 2007

Slides:



Advertisements
Similar presentations
Sampling, Aliasing.
Advertisements

Sampling and Reconstruction
RealityEngine Graphics Kurt Akeley Silicon Graphics Computer Systems.
Texture Mapping. Texturing  process that modifies the appearance of each point on a surface using an image or function  any aspect of appearance can.
David Luebke1/19/99 CS 551/651: Antialiasing David Luebke
MIT EECS 6.837, Durand and Cutler Sampling, Aliasing, & Mipmaps.
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.
Compositing and Blending Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
Compositing and Blending - Chapter 8 modified by Ray Wisman Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Image Compositing Angel 8.11 Angel: Interactive Computer Graphics5E © Addison-Wesley
Aliasing & Antialiasing
Advanced Computer Graphics (Fall 2010) CS 283, Lecture 3: Sampling and Reconstruction Ravi Ramamoorthi Some slides.
Sampling, Aliasing, & Mipmaps
CS248 Midterm Review. CS248 Midterm Mon, November 4, 7-9 pm, Terman Aud Mostly “short answer” questions – Keep your answers short and sweet! Covers lectures.
CS248 Midterm Review Derek Chan and Ethan Dreyfuss.
CSCE 641 Computer Graphics: Image Sampling and Reconstruction Jinxiang Chai.
CS248 Midterm Review Szymon Rusinkiewicz. CS248 Midterm Monday, November 1, 7-9 pm Gates B01 and B03 Designed to be 1-hour exam Mostly “short answer”
Sampling (Section 4.3) CS474/674 – Prof. Bebis. Sampling How many samples should we obtain to minimize information loss during sampling? Hint: take enough.
General Functions A non-periodic function can be represented as a sum of sin’s and cos’s of (possibly) all frequencies: F(  ) is the spectrum of the function.
CSCE 641 Computer Graphics: Image Sampling and Reconstruction Jinxiang Chai.
Laurent Itti: CS599 – Computational Architectures in Biological Vision, USC Lecture 4: Introduction to Vision 1 Computational Architectures in Biological.
Advanced Computer Graphics (Spring 2006) COMS 4162, Lecture 3: Sampling and Reconstruction Ravi Ramamoorthi
CS248 Midterm Review. CS248 Midterm Mon, November 3, 7-9 pm, Gates B01 Mostly “short answer” questions – Keep your answers short and sweet! Covers lectures.
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.
CS248 Midterm Review Michael Green and Sean Walker (based on the work of previous TAs)
Sampling and Aliasing Kurt Akeley CS248 Lecture 3 2 October 2007
Texture Mapping Kurt Akeley CS248 Lecture October 2007
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
Multisample Antialiasing Kurt Akeley CS248 Lecture 6 11 October 2007
CS248 Midterm Review. CS248 Midterm Mon, November 5, 7-9 pm, Terman Aud Mon, November 5, 3-5 pm, Gates 392 Mostly “short answer” questions Covers through.
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
… Representation of a CT Signal Using Impulse Functions
© 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.
Image Processing 고려대학교 컴퓨터 그래픽스 연구실 cgvr.korea.ac.kr.
Antialiasing CptS 548 Advanced Computer Graphics John C. Hart.
March Shape Drawing Algorithms Shmuel Wimer Bar Ilan Univ., Engineering Faculty.
Image Synthesis Rabie A. Ramadan, PhD 3. 2 Our Problem.
Antialiasing CAP4730: Computational Structures in Computer Graphics.
10/26/04© University of Wisconsin, CS559 Fall 2004 Last Time Drawing lines Polygon fill rules Midterm Oct 28.
CS 450: COMPUTER GRAPHICS ANTIALIASING SPRING 2015 DR. MICHAEL J. REALE.
Week 6 - Wednesday.  What did we talk about last time?  Light  Material  Sensors.
ECE 4710: Lecture #6 1 Bandlimited Signals  Bandlimited waveforms have non-zero spectral components only within a finite frequency range  Waveform is.
09/19/2002 (C) University of Wisconsin 2002, CS 559 Last Time Color Quantization Dithering.
Image Processing Basics. What are images? An image is a 2-d rectilinear array of pixels.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CMSC 635 Sampling and Antialiasing. Aliasing in images.
Compositing and Blending
MIT EECS Sampling, Aliasing, & Mipmaps. MIT EECS Last Time? Global illumination “physically accurate light transport” The rendering equation.
2D Sampling Goal: Represent a 2D function by a finite set of points.
UniS CS297 Graphics with Java and OpenGL Blending.
Sampling Theorem & Antialiasing
CS559: Computer Graphics Lecture 12: Antialiasing & Visibility Li Zhang Spring 2008.
David Luebke 3/17/2016 Advanced Computer Graphics Antialiasing David Luebke
Compositing and Blending Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Computer Graphics I, Fall 2008 Compositing and Blending.
Antialiasing. What is alias? Alias - A false signal in telecommunication links from beats between signal frequency and sampling frequency (from dictionary.com)
Sampling Week 7, Fri 17 Oct 2003 p1 demos sampling.
Advanced Computer Graphics
Deferred Lighting.
Sampling Theorem & Antialiasing
Lecture Signals with limited frequency range
(C) 2002 University of Wisconsin, CS 559
Sampling and Antialiasing
General Functions A non-periodic function can be represented as a sum of sin’s and cos’s of (possibly) all frequencies: F() is the spectrum of the function.
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
Presentation transcript:

Pre-Filter Antialiasing Kurt Akeley CS248 Lecture 4 4 October

CS248 Lecture 4Kurt Akeley, Fall 2007 Review

CS248 Lecture 4Kurt Akeley, Fall 2007 Aliasing Aliases are low frequencies in a rendered image that are due to higher frequencies in the original image.

CS248 Lecture 4Kurt Akeley, Fall 2007 Jaggies Original: Rendered:

CS248 Lecture 4Kurt Akeley, Fall 2007 Convolution theorem Let f and g be the transforms of f and g. Then Something difficult to do in one domain (e.g., convolution) may be easy to do in the other (e.g., multiplication)

CS248 Lecture 4Kurt Akeley, Fall 2007 Aliased sampling of a point (or line) x = * = F(s)f(x)

CS248 Lecture 4Kurt Akeley, Fall 2007 Aliased reconstruction of a point (or line) x = * = F(s)f(x) sinc(x)

CS248 Lecture 4Kurt Akeley, Fall 2007 Reconstruction error (actually none!) Original Signal Aliased Reconstruction Phase matters!

CS248 Lecture 4Kurt Akeley, Fall 2007 Sampling theory Fourier theory explains jaggies as aliasing. For correct reconstruction: n Signal must be band-limited n Sampling must be at or above Nyquist rate n Reconstruction must be done with a sinc function All of these are difficult or impossible in the general case. Let’s see why …

CS248 Lecture 4Kurt Akeley, Fall 2007 Why band-limiting is difficult Band-limiting primitives prior to rendering compromises image assembly in the framebuffer n Band-limiting changes (spreads) geometry n Finite spectrum  infinite spatial extent n Interferes with occlusion calculations n Leaves visible seams between adjacent triangles Can’t band-limit the final (framebuffer) image n There is no final image, there are only samples n If the sampling is aliased, there is no recovery Nyquist-rate sampling requires band-limiting

CS248 Lecture 4Kurt Akeley, Fall 2007 Why ideal reconstruction is difficult In theory: n Required sinc function has n Negative lobes (displays can’t produce negative light) n Infinite extent (cannot be implemented) In practice: n Reconstruction is done by a combination of n Physical display characteristics (CRT, LCD, …) n The optics of the human eye n Mathematical reconstruction (as is done, for example, in high-end audio equipment) is not practical at video rates.

CS248 Lecture 4Kurt Akeley, Fall 2007 Two antialiasing approaches are practiced Pre-filtering (this lecture) n Band-limit primitives prior to sampling n OpenGL ‘smooth’ antialiasing Increased sample rate (future lecture) n Multisampling, super-sampling n OpenGL ‘multisample’ antialiasing

CS248 Lecture 4Kurt Akeley, Fall 2007 Pre-Filter Antialiasing

CS248 Lecture 4Kurt Akeley, Fall 2007 Ideal point (or line cross section) x = * = F(s)f(x) sinc(x)

CS248 Lecture 4Kurt Akeley, Fall 2007 Band-limited unit disk x = * = F(s)f(x) sinc(x)

CS248 Lecture 4Kurt Akeley, Fall 2007 Almost-band-limited unit disk x = * = F(s)f(x) sinc(x) sinc 2 (x) Finite extent! sinc 3 (x)

CS248 Lecture 4Kurt Akeley, Fall 2007 Equivalences These are equivalent: n Low-pass filtering n Band-limiting n (Ideal) reconstruction These are equivalent: n Point sampling of band-limited geometry n Weighted area sampling (FvD ) of full-spectrum geometry

CS248 Lecture 4Kurt Akeley, Fall 2007 Pre-filter pros and cons Pros n Almost eliminates aliasing due to undersampling n Allows pre-computation of expensive filters n Great image quality (with important caveats!) Cons n Can’t handle interactions of primitives with area n Reconstruction is still a problem

CS248 Lecture 4Kurt Akeley, Fall 2007 Pre-filtering in the vertex pipeline Vertex assembly Primitive assembly Rasterization Fragment operations Display Vertex operations Application Primitive operations struct { float x,y,z,w; float r,g,b,a; } vertex; struct { vertex v0,v1,v2 } triangle; struct { short int x,y; float depth; float r,g,b,a; } fragment; struct { int depth; byte r,g,b,a; } pixel; Framebuffer Point sampling of pre- filtered primitives sets fragment alpha value Fragments are blended into the frame buffer

CS248 Lecture 4Kurt Akeley, Fall 2007 Pre-filter point rasterization alpha point being sampled at the center of this pixel

CS248 Lecture 4Kurt Akeley, Fall 2007 Pre-filter line rasterization line being sampled at the center of this pixel alpha

CS248 Lecture 4Kurt Akeley, Fall 2007 Pre-filtered primitive stored in table Supports pre-computation Simplifies distance calculation (square root in table) Can compensate for reconstruction errors n Sampling and reconstruction go hand-in-hand 3 Point size 4 X screen frac bits 4 Y screen frac bits 4 Pixel index 8 Fragment Alpha 32K x 8

CS248 Lecture 4Kurt Akeley, Fall 2007 Line tables get big! 5 Line slope 4 X screen frac bits 4 Y screen frac bits 4 Pixel index 8 1M x 8 3 Line width Fragment Alpha

CS248 Lecture 4Kurt Akeley, Fall 2007 Triangle pre-filtering is difficult Three arbitrary vertex locations define a huge parameter space n Resulting table is too large to implement Edges can be treated independently n But this is a poor approximation near vertexes, where two or three edges affect the filtering n And triangles can be arbitrarily small

CS248 Lecture 4Kurt Akeley, Fall 2007 Pre-filtering in the vertex pipeline Vertex assembly Primitive assembly Rasterization Fragment operations Display Vertex operations Application Primitive operations struct { float x,y,z,w; float r,g,b,a; } vertex; struct { vertex v0,v1,v2 } triangle; struct { short int x,y; float depth; float r,g,b,a; } fragment; struct { int depth; byte r,g,b,a; } pixel; Framebuffer Point sampling of pre- filtered primitives sets fragment alpha value Fragments are blended into the frame buffer

CS248 Lecture 4Kurt Akeley, Fall 2007 Ideal pre-filtered image assembly Impulse-defined points and lines have no area So they don’t occlude each other So fragments should be summed into pixels C’ pixel = C pixel + A frag C frag

CS248 Lecture 4Kurt Akeley, Fall 2007 Practical pre-filtered image assembly Frame buffers have limited numeric range So summation causes overflow or clamping ‘Uncorrelated’ clamped blend yields good results n But clamping R, G, and B independently causes color shift ‘Anti-correlated’ clamped blend is an alternative n Best for rendering pre-filtered triangles n sorted front-to-back n But requires frame buffer to store alpha values C’ pixel = (1-A frag )C pixel + A frag C frag

CS248 Lecture 4Kurt Akeley, Fall 2007 Anti-correlated blend function i = min(A frag, (1-A pixel )) A’ pixel = A pixel + I C’ pixel = C pixel + i C frag

CS248 Lecture 4Kurt Akeley, Fall 2007 Demo

CS248 Lecture 4Kurt Akeley, Fall 2007 OpenGL API glEnable(GL_POINT_SMOOTH); glEnable(GL_LINE_SMOOTH); glEnable(GL_POLYGON_SMOOTH); glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE);// sum glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);// blend glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE);// saturate

CS248 Lecture 4Kurt Akeley, Fall 2007 Filtering and Human Perception

CS248 Lecture 4Kurt Akeley, Fall 2007 Resolution of the human eye Eye’s resolution is not evenly distributed n Foveal resolution is ~20x peripheral n Systems can track direction of view, draw high- resolution inset n Flicker sensitivity is higher in periphery One eye can compensate for the other n Research at NASA suggests high-resolution dominant display Human visual system is well engineered …

CS248 Lecture 4Kurt Akeley, Fall 2007 Imperfect optics - linespread IdealActual

CS248 Lecture 4Kurt Akeley, Fall 2007 Linespread function

CS248 Lecture 4Kurt Akeley, Fall 2007 Filtering x = * = F(s)f(x)

CS248 Lecture 4Kurt Akeley, Fall 2007 Frequencies are selectively attenuated = * = f(x) *

CS248 Lecture 4Kurt Akeley, Fall 2007 Selective attenuation (cont.) = * = f(x) *

CS248 Lecture 4Kurt Akeley, Fall 2007 Modulation transfer function (MTF)

CS248 Lecture 4Kurt Akeley, Fall 2007 Optical “imperfections” improve acuity Image is pre-filtered n Cutoff is approximately 60 cpd n Cutoff is gradual – no ringing Aliasing is avoided n Foveal cone density is 120 / degree n Cutoff matches retinal Nyquist limit Vernier acuity is improved n Foveal resolution is 30 arcsec n Vernier acuity is 5-10 arcsec n Linespread blur includes more sensors

CS248 Lecture 4Kurt Akeley, Fall 2007 Summary Two approaches to antialiasing are practiced n Pre-filtering (this lecture) n Increased sample rate Pre-filter antialiasing n Works well for non-area primitives (points, lines) n Works poorly for area primitives (triangles, especially in 3-D) The human eye is well adapted n Sampling theory helps us here too

CS248 Lecture 4Kurt Akeley, Fall 2007 Assignments Before Thursday’s class, read n FvD 3.1 through 3.14, Rasterization Project 1: n Continue work n Demos Wednesday 10 October

CS248 Lecture 4Kurt Akeley, Fall 2007 End