lecture20-1 - CS 445 645 Introduction to Computer Graphics...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 445 / 645 Introduction to Computer Graphics Lecture 20 Antialiasing Environment Mapping Used to model a object that reflects surrounding textures Used to the eye to • Polished sphere reflects walls and ceiling textures • Cyborg in Terminator 2 reflects flaming destruction Texture is distorted fisheye view of environment Spherical texture mapping Spherical creates texture coordinates that correctly index into this texture map this Materials from NVidia http://developer.nvidia.com/object/Cube_Mapping_Paper.html Sphere Mapping Blinn/Newell Lattitude Mapping Cube Mapping Multitexturing Pipelining of multiple texture applications to one Pipelining polygon polygon The results of each texture unit application is The passed to the next texture unit, which adds its effects effects More bookkeeping is required to pull this off 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 no area • It cannot be seen • It can have a coordinate A pixel is more than a point, it is a sample Samples Most things in the real world are continuous Most continuous Everything in a computer is discrete Everything discrete The process of mapping a continuous function to a The discrete one is called sampling sampling The process of mapping a continuous variable to a The discrete one is called quantization quantization Rendering an image requires sampling and Rendering quantization quantization Samples Samples Line Segments We tried to sample a line segment so it would map We to a 2D raster display to We quantized the pixel values to 0 or 1 We saw stair steps, or jaggies Line Segments Instead, quantize to many shades But what sampling algorithm is used? Area Sampling Shade pixels according to the area covered by thickened Shade line line This is unweighted area sampling This unweighted A rough approximation formulated by dividing each pixel rough into a finer grid of pixels into Unweighted Area Sampling Primitive cannot affect intensity of pixel if it does Primitive not intersect the pixel not Equal areas cause equal intensity, regardless of Equal distance from pixel center to area distance Weighted Area Sampling Unweighted sampling colors two pixels identically Unweighted when the primitive cuts the same area through the two pixels the Intuitively, pixel cut through the center should be Intuitively, more heavily weighted than one cut along corner corner Weighted Area Sampling Weighting function, W(x,y) • specifies the contribution of primitive passing through specifies the point (x, y) from pixel center the Intensity W(x,y) x Images An image is a 2D function I(x, y) that specifies An (x, intensity for each point (x, y) intensity Sampling and Image Our goal is to convert the continuous image to a Our discrete set of samples discrete The graphics system’s display hardware will The attempt to reconvert the samples into a continuous image: reconstruction reconstruction Point Sampling an Image Simplest sampling is on a grid Sample depends solely on value at grid points Point Sampling Multiply sample grid by image intensity to obtain a Multiply discrete set of points, or samples. discrete Sampling Geometry Sampling Errors Some objects missed entirely, others poorly sampled sampled Fixing Sampling Errors Supersampling • Take more than one sample for each pixel and combine Take them them – How many How samples is enough? enough? – How do we How know no features are lost? lost? 150x15 to 100x10 200x20 to 100x10 300x30 to 100x10 400x40 to 100x10 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 Signal Theory Intensity Convert spatial signal to frequency domain Pixel position across scanline Example from Foley, van Dam, Feiner, and Hughes Signal Theory Represent spatial Represent signal as sum of sine waves (varying frequency and phase shift) and Very commonly used to represent sound “spectrum” Fourier Analysis Convert spatial domain to frequency domain • Let f(x) indicate the intensity at a location in space, x (pixel value) Let f(x) (pixel • u is a complex number representing frequency and phase shift – i = sqrt (-1) … frequently not plotted • F(u) is the amplitude of a particular frequency in a signal – In this case the signal is f(x) In f(x) Fourier Transform Examples of spatial Examples and frequency domains domains Nyquist Sampling Theorem The ideal samples of a continuous function The contain all the information in the original function if and only if the continuous function is sampled at a frequency greater than twice the highest frequency in the function frequency Nyquist Rate The lower bound on the sampling rate equals The twice the highest frequency component in the image’s spectrum image’s This lower bound is the Nyquist Rate Band-limited Signals If you know a function contains no components of If frequencies higher than x • Band-limited implies original function will not require any Band-limited ideal functions with frequencies greater than x ideal • This facilitates reconstruction Flaws with Nyquist Rate Samples may not align with peaks Flaws with Nyquist Rate When sampling below Nyquist Rate, resulting When signal looks like a lower-frequency one signal • With no knowledge of band-limits, samples could have With been derived from signal of higher frequency been Low-pass Filtering • We know we are limited in the resolution of our screen • We want the screen (sampling grid) to have twice the resolution We of the signal (image) we want to display of • How can we reduce the high-frequencies of the image? How – Low-pass filter – Band-limits the image Low-pass Filtering In frequency domain • If signal is F(u) • Just chop off parts of F(u) in high frequencies using a second Just function, G(u) function, – G(u) == G(u) 1 when –k <= u <= k when 0 elsewhere – This is called the pulse function Low-pass Filtering In spatial domain • Multiplying two Fourier transforms in the spatial domain Multiplying corresponds exactly to performing an operation called convolution in the spatial domain convolution • f(x) * g(x) = h(x) the convolution of f with g… f(x) – The value of h(x) at x is the integral of the product of f(x) The with the filter g(x) such that g(x) is centered at x with • The pulse (frequency) == sinc (spatial) Low-pass Filtering In spatial domain Sinc: sinc(x) = sin (π x)/π x • Note this isn’t perfect way to eliminate high frequencies – “ringing” occurs Sinc Filter Slide filter along Slide spatial domain and compute new pixel value that results from convolution from 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 How is this done today? Full Screen Antialiasing Nvidia GeForce2 • OpenGL: render image 400% larger and supersample • Direct3D: render image 400% - 1600% larger Nvidia GeForce3 • Multisampling but with fancy overlaps – Don’t render at higher resolution – Use one image, but combine values of neighboring pixels – Beware of recognizable combination artifacts Human perception of patterns is too good GeForce3 Multisampling • After each pixel is rendered, write pixel value to two After different places in frame buffer different 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 Resolve computing average between each pixel from Sample 1 (black) and the four pixels from Sample 2 (red) that are 1/ sqrt(2) pixels away away GeForce3 - Multisampling No AA No AA Multisampling Multisampling GeForce3 - Multisampling • 4x Supersample Multisampling ATI Smoothvision ATI SmoothVision • Programmer selects Programmer samping pattern samping • Some supersampling thrown in ATI NVidia comparison ATI Radeon 8500 ATI AA Off 2x AA NVidia GF3 Ti 500 Quincunx AA http://www.anandtech.com/video/showdoc.html?i=1562&p=4 3dfx 3dfx Multisampling • 2- or 4-frame shift and average Tradeoffs? ...
View Full Document

This note was uploaded on 01/23/2012 for the course CS 445 taught by Professor Bloomfield,a during the Spring '08 term at UVA.

Ask a homework question - tutors are online