cs148: introduction to computer graphics and imaging midterm review session
Post on 22-Dec-2015
222 views
TRANSCRIPT
CS148: Introduction to Computer Graphics and Imaging
Midterm Review Session
CS148 Midterm Review Pat Hanrahan, Winter 2007
Outline
Midterm info
Review of topics
Drawing in OpenGL
Geometry: points, lines, vectors
Transforms and coordinate systems
Fonts/typography
Splines
Input devices and interaction
Color
Cameras and perspective
CS148 Midterm Review Pat Hanrahan, Winter 2007
Midterm info
Time: Tue, Feb 13th at 7pm
Location: Building 260, Rm 113
Duration: 2 hours
Closed book
Consists of a few (4 or 5) multi-part questions
All material through last lecture (cameras)
Strongly emphasized: material on assignments
Focus on: material from lectures
Also covered: material from readings
CS148 Midterm Review Pat Hanrahan, Winter 2007
Drawing in OpenGL
OpenGL primitives
glBegin/glEnd
Double buffering
GLUT events
display
reshape
keyboard
CS148 Midterm Review Pat Hanrahan, Winter 2007
Geometry
Dot product
Cross product
What are orthonormal vectors?
Can you add two points?
What do you get when you add a vector to a point?
CS148 Midterm Review Pat Hanrahan, Winter 2007
Geometry
Line defined by (x1, y1) and (x2, y2)
What is parametric form?
What is implicit form?
Which side of the line is point P on?
CS148 Midterm Review Pat Hanrahan, Winter 2007
Transforms
Think about them in two ways
Applying to object
Applying to coordinate axes
Order matters
CS148 Midterm Review Pat Hanrahan, Winter 2007
Transforms
Translate(1,1)
Rotate(45O)
CS148 Midterm Review Pat Hanrahan, Winter 2007
Transforms – Apply to object
Translate(1,1)
Rotate(45O)
CS148 Midterm Review Pat Hanrahan, Winter 2007
Transforms – Apply to object
Translate(1,1)
Rotate(45O)
CS148 Midterm Review Pat Hanrahan, Winter 2007
Transforms – Apply to coordinate system
Translate(1,1)
Rotate(45O)
CS148 Midterm Review Pat Hanrahan, Winter 2007
Transforms – Apply to coordinate system
Translate(1,1)
Rotate(45O)
CS148 Midterm Review Pat Hanrahan, Winter 2007
Transforms – Apply to coordinate system
Translate(1,1)
Rotate(45O)
CS148 Midterm Review Pat Hanrahan, Winter 2007
Transforms – order matters
Translate(1,0)
Rotate(45O)
Rotate(45O)Translate(1,
0)
CS148 Midterm Review Pat Hanrahan, Winter 2007
Transforms – order matters
Scale(2,2)Translate(0,
1)
Translate(0,1)
Scale(2,2)
CS148 Midterm Review Pat Hanrahan, Winter 2007
Transforms
Homogeneous coordinates
Transforms as matrices
100
030
002
200
020
002
100
110
101
100
05.886.
0886.5.
1000
0100
1001.0
10001.
CS148 Midterm Review Pat Hanrahan, Winter 2007
Transforms
Homogeneous coordinates
Transforms as matrices
100
030
002
200
020
002
100
110
101
100
05.886.
0886.5.
1000
0100
1001.0
10001.
glScalef(2.0, 3.0) No change glTranslatef(1.0, 1.0)
glRotatef(60.0, 0.0, 0.0, 1.0)gluOrtho (0, 200, 0, 200,-1.0, 1.0)
CS148 Midterm Review Pat Hanrahan, Winter 2007
Transforms
Some volume of coordinate space is viewable on screen.
Orthographic projection
glOrtho/gluOrtho2D
Perspective projection
gluPerspective
glFrustum
CS148 Midterm Review Pat Hanrahan, Winter 2007
Transforms
Transforms implemented as matrix vector multiplications
1
0
1
glTranslate
glRotate
glScale
glRotate
glScale
glRotate
glTranslate
gluPerspective
glViewport
Modeling transform(object space to world space)
Viewing transform(world space to camera space)
Projection transform(camera space to clip space)
(to window coordinates)
[vertex V]Ex: (1,0) in object space
M1 M2 M3 M4 M5 M6 M9…=
Vertex position in window= (vx,vy)
1
vy
vx
CS148 Midterm Review Pat Hanrahan, Winter 2007
Typography
Font units
Terminology
Character map
Glyphs + glyph metrics
Kerning
Leading
CS148 Midterm Review Pat Hanrahan, Winter 2007
Interpolation
Have discrete set of points
Want continuous function going through points
CS148 Midterm Review Pat Hanrahan, Winter 2007
Interpolation
Bilinear interpolation
Barycentric interpolation
V3
V2V1
3
2 1V
V = 1V1 + 2V2 + 3V3
1 + 2 + 3 = 1
CS148 Midterm Review Pat Hanrahan, Winter 2007
Interpolation
Want curve p(t) to go through all control points Ci
CS148 Midterm Review Pat Hanrahan, Winter 2007
Cubic splines
Basis functions (Bi’s) are cubic polynomials
Different basis functions yield splines with different properties
Hermite Splines
Catmull-Rom Splines
Bezier Splines
)()()()()( 33221100 tBptBptBptBptf
CS148 Midterm Review Pat Hanrahan, Winter 2007
Input devices
The user presses a key. What happens?
CS148 Midterm Review Pat Hanrahan, Winter 2007
Input devices
The user presses a key. What happens?
Scan code (make and break codes)
Virtual key code
Glyph index
Glyph
CS148 Midterm Review Pat Hanrahan, Winter 2007
Input devices
How does a mouse work?
What is quadrature encoding?
Joystick input
Axes/buttons/D-pads
CS148 Midterm Review Pat Hanrahan, Winter 2007
Interaction
Polling vs. events
Events
Event loop
Event queues
Callbacks (event handlers)
Associating events with objects
Propagating events
Model-view-controller pattern
CS148 Midterm Review Pat Hanrahan, Winter 2007
Physics of light
Energy from source distributed across many wavelengths: S()
Units: Watts
CS148 Midterm Review Pat Hanrahan, Winter 2007
Physics of light
Adding light
L() = E1() + E2()
Filtering light
L() = T()E()
Sensor Response
dERR )()(
CS148 Midterm Review Pat Hanrahan, Winter 2007
Color perception
What color do we perceive from E()?
Explain statement: humans have trichromatic color vision
Rods and Cones
CS148 Midterm Review Pat Hanrahan, Winter 2007
Color perception
What is the CIEXYZ color space?
Why is the region within the spectral locus the span of all observable colors?
Luminance
Think: Response of rods to E()
Units = lumens
Lightness = Luminance1/3
CS148 Midterm Review Pat Hanrahan, Winter 2007
Cameras and Lenses
Pinhole camera
film
f
x’
(x,z)
pinhole
Field of view
CS148 Midterm Review Pat Hanrahan, Winter 2007
Cameras and Lenses
Pinhole camera
z
fxx '
film
f
x’
(x,z)
pinhole
Field of view
f
xfov ')
2tan(
CS148 Midterm Review Pat Hanrahan, Winter 2007
Cameras and Lenses
Focal length
How does is correspond to zoom?
Depth of field
Can a pinhole camera produce depth of field effects?
Bayer mosaic