CS148: Introduction to Computer Graphics Final Review Session
CS148: Introduction to Computer Graphics
Final Review Session
CS148 Final Review Winter 2008
Outline
Final Info
Review of TopicsMattes and CompositingSampling and FilteringCompressionProgrammable ShadingCamerasRenderingModeling
CS148 Final Review Winter 2008
Final Exam Info
Time: Thursday March 20, 12:15Location: Meyer Forum 112Duration: 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 EquationC = α * CF + (1 – α) * CB
Premultiplied α: C’ = αC = (αr, αg, αb, α)
α
CS148 Final Review Winter 2008
Porter-Duff Compositing Algebra
BBAA CFCFc
CS148 Final Review Winter 2008
Green Screen Matte Extraction
Given:C – Observed colorCB – 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 Domainf(x,y)
Frequency DomainF(ωx, ωy)
Fourier Transform
InverseFourier
Transform
Convolution Multiplication
Multiplication Convolution
Sinc Box
CS148 Final Review Winter 2008
Convolution
Convolution – integration/summation of translated filter with signal
n
nmgnfmgf )()())(*(
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 CodingRun length coding – exploit obvious redundancyHuffman 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)
Image
DiscreteCosine
TransformTransformed
Image
Quantization
(Lossy Step)
Reorder+
Coding CompressedData 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
6.25 0 -1 -2 0 0
Full Transform
High Resolution DetailsMedium Resolution DetailsLow Resolution DetailsAverage Value
-.5.75
CS148 Final Review Winter 2008
Rendering Pipeline
Vertex Data
Primitive Data
Tessellation
Vertex Processin
g
Geometry Processin
g
Pixel Processin
g
Texture Sampler
Textured Surface
Pixel Rendering
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
film
f
x’
(x,z)
pinhole
Field of view
CS148 Final Review Winter 2008
Pinhole Camera
z
fxx '
film
f
x’
(x,z)
pinhole
Field of view
f
xfov ')
2tan(
CS148 Final Review 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
RepresentationsDense Polygonal MeshesBicubic surfacesSubdivision Surfaces
OperationsInstancingTransformation – linear and non-linearCompression, simplificationDeform, skin, morph, animateSmoothSet operations
CS148 Final Review Winter 2008
Bezier Curve
CS148 Final Review Winter 2008
Subdivision Surfaces
Loop subdivision algorithmExtraordinary points