CG-lecture08 - Introduction to Computer Graphics Lecture 8...

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: Introduction to Computer Graphics Lecture 8 Antialiasing Towards the Ideal Line We can only do a discrete approximation Illuminate pixels as close to the true path as Illuminate possible, consider bi-level display only possible, • Pixels are either lit or not lit What is a ideal pixel (point)? A ideal pixel is not… • A box • A disk A ideal pixel is a point • It has no dimension • It occupies no area • It cannot be seen • It can have a coordinate A ideal 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 Antialiasing Ideally, one want to eliminate the aliasing in Ideally, images. images. Practically, one can weaken the aliasing in Practically, images. images. Samples Samples Does anti-aliasing need programming? The programming for anti-aliasing is included in The GL. GL. The normal graphics applications do not need The programming for this. programming 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 signal as sum of sine waves Represent (varying frequency and phase shift) (varying Very commonly used to represent sound Very “spectrum” “spectrum” Signal Theory Signal Theory The essential of Fourier Analysis Consider the dot product of two 3D vectors. ( x1 y1 x2 z1 ) y 2 = x1 x 2 + y1 y 2 + z1 z 2 z 2 Consider the dot product of two nD vectors. (x 1 1 x1 2 x12 2 1 x2 1 2 2 ...... x n ) = x1 x12 + x 1 x 2 + ......x 1 x n 2 n ...... x2 n The essential of Fourier Analysis Consider the integral of two functions, and recall Consider the infinite dimension vectors. the ∫ +∞ −∞ f ( x) g ( x)dx = f ( x) • g ( x) T The integral of two functions is the dot product of The the two infinite dimension vectors. the Signal or Vector? Consider this function: + ∞ x = 0 δ ( x) = 0 x≠0 Can a signal be represented as the following? +∞ f ( x' ) = ∫ f ( x)δ ( x − x' )dx −∞ The essential of Fourier Analysis Consider one interesting property of cosine (or sine) Consider functions. functions. ∫ +∞ −∞ iff cos ω1 x ⋅ cos ω2 x ⋅ dx = 0 ω1 ≠ ω2 If the frequencies are different for these two cosine If function, these two infinite vectors are vertical to each other. other. The essential of Fourier Analysis All cosine functions with different frequencies All construct one orthogonal vector basis for infinite dimension vector space. dimension All kinds of functions can be represented as the All linear combination of this vector basis. linear The essential of Fourier Analysis Now consider the purpose of the Fourier Transformation. +∞ F (ω ) = ∫ f ( x) cos(ωx)dx −∞ Only two vectors with the same frequency can yield the non-zero Only integral. The purpose of Fourier Transformation is to extract the extent of each basic vector (cosine function) in this given function f(x) ( a singal). How about the converse transformation? How Fourier Transform Examples of spatial and frequency domains Fourier Transform Examples of spatial and frequency 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 Original Signal & Sampled Signal Original Signal & Sampled Signal A A f A f A f Nyquist theory explain in frequency domain. f How about the sampling for an ideal line? y Intensity L y=y0 y0 x0 x x0 x This is an impact function. How about the sampling for an ideal line? A A Fourier Transformation 1 t f The sampling rate must be infinite number for non-aliasing sampling. What can we do for this difficulty? Low pass signal A A Fourier Transformation t The sampling rate can be finite, but the line is much wider. f Summary of aliasing. (1) Sampling theory tells us aliasing is caused by frequencies Sampling being present above the Nyquist limit. Nyquist (2) The aliasing is also caused by the approximate sampling The location. location. Summary of aliasing. Ideal solution : band-pass filter to remove high frequencies. This function is an impractical filter. Sampling Pipeline Sampling Pipeline 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 Antialiasing lines. Obvious : Need a grey level and area sample display Obvious in order to remove aliasing. in 1 pixel Price to be paid : trade off spatial resolution • Line appears more ‘blurred’, it’s exact position is no longer as well Line exact defined. defined. • In practice : contrast of lines much reduced. In Line Segments Instead, quantize to many shades But what sampling algorithm is used? Antialiasing by area sampling. Draw line as thin rectangle. Calculate area of square pixel covered by line Calculate 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 Weighted area filtering Conical filter. Easy to compute, symmetrical. Lines are same distance from pixel centre, but area of pixel covered is very different in the square case Weighted area filtering. Diameter is 2 pixels, so overlap occurs • Ensures all of the grid is covered Area is normalised Only need to know distance from pixel centre to Only line line Gupta-Sproull algorithm. Summary of antialiasing lines Use square unweighted average filter • Poor representation of line. Weighted average filter better Use Cone • Symmetrical, only need to know distance • Use decision variable calculated in Bresenham. • Gupta-Sproull algorithm. Anti-Aliasing in Image Because the area-sampling lines have no clear Because boundaries, it is difficult to perform region filling. boundaries, Is there a method which can combine anti-aliasing Is and region filling? and 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 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 Use pixels pixels 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 Multisampling GeForce3 - Multisampling • 4x Supersample Multisampling ATI NVidia comparison ATI Radeon 8500 ATI AA Off 2x AA NVidia GF3 Ti 500 Quincunx AA 3dfx 3dfx Multisampling • 2- or 4-frame shift and average Tradeoffs? ...
View Full Document

This note was uploaded on 06/12/2011 for the course ECON 101 taught by Professor Professor during the Spring '10 term at Cisco Junior College.

Ask a homework question - tutors are online