CS148: Introduction to Computer Graphics Final Review Session Outline Final Info Review of Topics Mattes and Compositing Sampling and Filtering Compression Programmable Shading Cameras Rendering Modeling CS148 Final Review Winter 2008 Final Exam Info Time: Thursday March 20, 12:15 Location: Meyer Forum 112 Duration: 3 hours Closed book Consists of a few (4 or 5) multi-part questions Emphasis on the second half of the course, but don’t forget the first half CS148 Final Review Winter 2008 Mattes and Compositing α = Coverage = Area = Opacity = 1 – Transparency α Standard Compositing Equation C = α * CF + (1 – α) * CB Premultiplied α: C’ = αC = (αr, αg, αb, α) CS148 Final Review Winter 2008 Porter-Duff Compositing Algebra c FACA FBCB CS148 Final Review Winter 2008 Green Screen Matte Extraction Given: C – Observed color CB – Backing color Compute: CF = (αFRF, αFGF, αFBF, αF) Compositing Equation: C = CF + (1 – αF)CB 3 Equations, 4 Unknowns – must make some assumptions CS148 Final Review Winter 2008 The Horrors of Poor Sampling CS148 Final Review Winter 2008 The Horrors of Poor Sampling Retort sequence by Don Mitchell CS148 Final Review Winter 2008 Nyquist Frequency Nyquist Frequency – ½ the sampling frequency A periodic signal with a frequency above the Nyquist frequency cannot be distinguished from a periodic signal below the Nyquist frequency These indistinguishable signals are called aliases CS148 Final Review Winter 2008 Fourier Transform You can express any (periodic) signal as a sum of sinusoids CS148 Final Review Winter 2008 Fourier Transform Spatial Domain f(x,y) Fourier Transform Inverse Fourier Transform Frequency Domain F(ωx, ωy) Convolution Multiplication Multiplication Convolution Sinc Box CS148 Final Review Winter 2008 Convolution Convolution – integration/summation of translated filter with signal ( f * g )( m) f (n) g (m n) n CS148 Final Review Winter 2008 Fourier Transform CS148 Final Review Winter 2008 Low Pass Filter CS148 Final Review Winter 2008 High Pass Filter CS148 Final Review Winter 2008 Band Pass Filter CS148 Final Review Winter 2008 Sampling – Spatial Domain CS148 Final Review Winter 2008 Sampling – Frequency Domain CS148 Final Review Winter 2008 Reconstruction – Frequency Domain CS148 Final Review Winter 2008 Reconstruction – Spatial Domain CS148 Final Review Winter 2008 Undersampling – Frequency Domain CS148 Final Review Winter 2008 Compression Kolmogorov Complexity – smallest program to generate data Lossless Coding Run length coding – exploit obvious redundancy Huffman Coding – variable length code, highly probable characters -> shorter codes Transform Coding – perform invertible transform on data to make it more amenable to compression (applies to lossless and lossy!) CS148 Final Review Winter 2008 Lossy Image Compression (JPEG) Discrete Cosine Transform Image Transformed Image Quantization (Lossy Step) Reorder + Coding Compressed Data Stream JPEG2000 is similar but uses the wavelet transform. Exploit human perception – quantize high frequencies more heavily since we are less sensitive to them. CS148 Final Review Winter 2008 Wavelet Transform Just another invertible transform (expresses signal in different basis) Generated in steps by calculating smoothed (approximate) values and detail (corrective) values Resulting basis functions have compact support – they are only non-zero over a limited range – error in coefficient causes localized error CS148 Final Review Winter 2008 Wavelet Transform 6 8 5 9 5 5 6 6 Full Transform 6.25 .75 0 -.5 -1 -2 0 0 High Resolution Details Medium Resolution Details Low Resolution Details Average Value CS148 Final Review Winter 2008 Rendering Pipeline Vertex Data Tessellation Vertex Processing Geometry Processing Pixel Processing Pixel Rendering Primitive Data Texture Sampler Textured Surface CS148 Final Review Winter 2008 Example Vertex Shader Vertex Shader CS148 Final Review Winter 2008 Example Pixel Shader Pixel Shader CS148 Final Review Winter 2008 GPGPU CPU Thread synchronization Bandwidth limitations Scheduling overhead Small number of cores GPU All threads independent Message passing is not allowed Resource allocation is done by GPU Many cores available (12 to 48 typical) CS148 Final Review Winter 2008 GPGPU Applications Beyond triangle rendering Collision detection Fluid simulation Physics Raytracing Video compression Beyond graphics Folding@Home Speech Recognition Partial differential equation solvers Fourier transform CS148 Final Review Winter 2008 Pinhole Camera (x,z) f Field of view film x’ pinhole CS148 Final Review Winter 2008 Pinhole Camera (x,z) f Field of view film x’ pinhole fx x' z CS148 Final Review fov x' tan( ) 2 f Winter 2008 Homogeneous Coordinates CS148 Final Review Winter 2008 Perspective Transform CS148 Final Review Winter 2008 Orthographic Projection CS148 Final Review Winter 2008 Field of View and Focal Length CS148 Final Review Winter 2008 Depth of Field CS148 Final Review Winter 2008 Circle of Confusion CS148 Final Review Winter 2008 Types of Reflection Mirror Ideal reflection Reflection law Diffuse Matte Lambert’s Law Specular Highlights and gloss Microfacet model CS148 Final Review Winter 2008 Lambert’s Law CS148 Final Review Winter 2008 Ideal Reflection CS148 Final Review Winter 2008 Microfacets CS148 Final Review Winter 2008 Modeling Representations Dense Polygonal Meshes Bicubic surfaces Subdivision Surfaces Operations Instancing Transformation – linear and non-linear Compression, simplification Deform, skin, morph, animate Smooth Set operations CS148 Final Review Winter 2008 Bezier Curve CS148 Final Review Winter 2008 Subdivision Surfaces Loop subdivision algorithm Extraordinary points CS148 Final Review Winter 2008