cs148: introduction to computer graphics and imaging midterm review session

35
CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

Post on 22-Dec-2015

222 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

CS148: Introduction to Computer Graphics and Imaging

Midterm Review Session

Page 2: 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

Page 3: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

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

Page 4: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

CS148 Midterm Review Pat Hanrahan, Winter 2007

Drawing in OpenGL

OpenGL primitives

glBegin/glEnd

Double buffering

GLUT events

display

reshape

keyboard

Page 5: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

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?

Page 6: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

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?

Page 7: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

CS148 Midterm Review Pat Hanrahan, Winter 2007

Transforms

Think about them in two ways

Applying to object

Applying to coordinate axes

Order matters

Page 8: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

CS148 Midterm Review Pat Hanrahan, Winter 2007

Transforms

Translate(1,1)

Rotate(45O)

Page 9: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

CS148 Midterm Review Pat Hanrahan, Winter 2007

Transforms – Apply to object

Translate(1,1)

Rotate(45O)

Page 10: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

CS148 Midterm Review Pat Hanrahan, Winter 2007

Transforms – Apply to object

Translate(1,1)

Rotate(45O)

Page 11: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

CS148 Midterm Review Pat Hanrahan, Winter 2007

Transforms – Apply to coordinate system

Translate(1,1)

Rotate(45O)

Page 12: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

CS148 Midterm Review Pat Hanrahan, Winter 2007

Transforms – Apply to coordinate system

Translate(1,1)

Rotate(45O)

Page 13: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

CS148 Midterm Review Pat Hanrahan, Winter 2007

Transforms – Apply to coordinate system

Translate(1,1)

Rotate(45O)

Page 14: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

CS148 Midterm Review Pat Hanrahan, Winter 2007

Transforms – order matters

Translate(1,0)

Rotate(45O)

Rotate(45O)Translate(1,

0)

Page 15: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

CS148 Midterm Review Pat Hanrahan, Winter 2007

Transforms – order matters

Scale(2,2)Translate(0,

1)

Translate(0,1)

Scale(2,2)

Page 16: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

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.

Page 17: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

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)

Page 18: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

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

Page 19: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

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

Page 20: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

CS148 Midterm Review Pat Hanrahan, Winter 2007

Typography

Font units

Terminology

Character map

Glyphs + glyph metrics

Kerning

Leading

Page 21: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

CS148 Midterm Review Pat Hanrahan, Winter 2007

Interpolation

Have discrete set of points

Want continuous function going through points

Page 22: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

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

Page 23: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

CS148 Midterm Review Pat Hanrahan, Winter 2007

Interpolation

Want curve p(t) to go through all control points Ci

Page 24: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

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

Page 25: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

CS148 Midterm Review Pat Hanrahan, Winter 2007

Input devices

The user presses a key. What happens?

Page 26: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

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

Page 27: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

CS148 Midterm Review Pat Hanrahan, Winter 2007

Input devices

How does a mouse work?

What is quadrature encoding?

Joystick input

Axes/buttons/D-pads

Page 28: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

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

Page 29: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

CS148 Midterm Review Pat Hanrahan, Winter 2007

Physics of light

Energy from source distributed across many wavelengths: S()

Units: Watts

Page 30: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

CS148 Midterm Review Pat Hanrahan, Winter 2007

Physics of light

Adding light

L() = E1() + E2()

Filtering light

L() = T()E()

Sensor Response

dERR )()(

Page 31: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

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

Page 32: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

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

Page 33: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

CS148 Midterm Review Pat Hanrahan, Winter 2007

Cameras and Lenses

Pinhole camera

film

f

x’

(x,z)

pinhole

Field of view

Page 34: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

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(

Page 35: CS148: Introduction to Computer Graphics and Imaging Midterm Review Session

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