games101 lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · constant exposure: f-stop vs shutter...

63
Introduction to Computer Graphics GAMES101, Lingqi Yan, UC Santa Barbara Cameras, Lenses and Light Fields Lecture 19: http://www.cs.ucsb.edu/~lingqi/teaching/games101.html

Upload: others

Post on 20-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

Introduction to Computer GraphicsGAMES101, Lingqi Yan, UC Santa Barbara

Cameras, Lenses and Light FieldsLecture 19:

http://www.cs.ucsb.edu/~lingqi/teaching/games101.html

Page 2: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Announcements

• Standalone topics this week

- No related homework for lectures in this week

• Final project ideas will be released soon

- Note: submit your (very short) proposal on/before Apr 19, if you want to do something else (encouraged)

2

Page 3: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

Imaging = Synthesis + Capture

Page 4: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

What’s Happening Inside the Camera?

4

Cross-section of Nikon D3, 14-24mm F2.8 lens

Page 5: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Pinholes & Lenses Form Image on Sensor

5

London and Upton

(փఽ)

Page 6: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Shutter Exposes Sensor For Precise Duration

6

The Slow Mo Guys, https://youtu.be/CmjeCchGRQo

(ளᳪ)

Page 7: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Sensor Accumulates Irradiance During Exposure

7

Page 8: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Why Not Sensors Without Lenses?

Each sensor point would integrate light from all points on the object, so all pixel values would be similar i.e. the sensor records irradiance

8

Lond

on a

nd U

pton

but there is computational imaging research…

Page 9: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

Pinhole Image Formation

Page 10: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

A. H. Zewail, Phil. Trans. R. Soc. A 2010;368:1191-1204

Mo Tzu (c. 470–c. 390 BC)

Aristotle (384–322 BC)

Ibn al-Haytham (965–1040)

Shen Kuo (1031–1095)

Roger Bacon (c. 1214–1294)

Johannes Kepler (1571–1630)

Pinhole Camera

10

Page 11: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Largest Pinhole Photograph

11

legacyphotoproject.com

Page 12: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Largest Pinhole Photograph

12

legacyphotoproject.com

Page 13: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

Field of View (FOV)(ᥤ)

Page 14: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Effect of Focal Length on FOV

For a fixed sensor size, decreasing the focal length increases the field of view.

14

FOV = 2 arctan

✓h

2f

Lens

Sensor

Focal lengthf

h

FOV = 2 arctan

✓h

2f

h

f

FOV = 2 arctan

✓h

2f

(ᆌ᪗)

Page 15: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Focal Length v. Field of View

• For historical reasons, it is common to refer to angular field of view by focal length of a lens used on a 35mm-format film (36 x 24mm)

• Examples of focal lengths on 35mm format:

• 17mm is wide angle 104°

• 50mm is a “normal” lens 47°

• 200mm is telephoto lens 12°

• Careful! When we say current cell phones have approximately 28mm “equivalent” focal length, this uses the above convention.

15

Page 16: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Focal Length v. Field of View

16

From London and Upton, and Canon EF Lens Work III

Page 17: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Effect of Sensor Size on FOV

17

Object

Lens

Sensor(s)

35mm Full Frame

APS-C

Page 18: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Sensor Sizes

18

Credit: lensvid.com

Page 19: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Maintain FOV on Smaller Sensor?

19

Lens

Large Sensor

To maintain FOV, decrease focal length of lens in proportion to width/height of sensor

Focal length

LensSmall Sensor

Shorter focal

length

Page 20: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

Exposure

Page 21: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Exposure

• H = T x E

• Exposure = time x irradiance

• Exposure time (T)

- Controlled by shutter

• Irradiance (E)

- Power of light falling on a unit area of sensor

- Controlled by lens aperture and focal length

21

Page 22: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Exposure Controls in Photography

Aperture size

• Change the f-stop by opening / closing the aperture (if camera has iris control)

Shutter speed

• Change the duration the sensor pixels integrate light

ISO gain (ఽطଶ)

• Change the amplification (analog and/or digital) between sensor values and digital image values

22

Page 23: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Exposure: Aperture, Shutter, Gain (ISO)

23

Photoblog Hamburg

Page 24: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

ISO (Gain)

Third variable for exposure

Film: trade sensitivity for grain

Digital: trade sensitivity for noise

• Multiply signal before analog-to-digital conversion

• Linear effect (ISO 200 needs half the light as ISO 100)

24

Page 25: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

ISO Gain vs Noise in Canon T2i

25

Credit: bobatkins.com

Page 26: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

F-Number (F-Stop): Exposure Levels

26

https://www.dpmag.com/how-to/tip-of-the-week/how-and-why-to-use-auto-exposure-bracketing/

Written as FN or F/N. N is the f-number.

Informal understanding: the inverse-diameter of a round aperture

Page 27: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Physical Shutter (1/25 Sec Exposure)

27

The Slow Mo Guys, https://youtu.be/CmjeCchGRQo

Page 28: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Side Effect of Shutter Speed

Motion blur: handshake, subject movement

Doubling shutter time doubles motion blur

28

Gavin H

oey http://w

ww.gavtrain.com

/?p=3960

Page 29: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Side Effect of Shutter Speed

Note: motion blur is not always bad!

Tip: think about anti-aliasing

29

London

Page 30: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Side Effect of Shutter Speed

30

https://www.premiumbeat.com/blog/3-tips-for-dealing-with-rolling-shutter/

Rolling shutter: different parts of photo taken at different times

Page 31: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Constant Exposure: F-Stop vs Shutter Speed

• Photographers must trade off depth of field (?) and motion blur for moving subjects

31

1.4 2.0 2.8 4.0 5.6 8.0 11.0 16.0 22.0 32.0

1/500 1/250 1/125 1/60 1/30 1/15 1/8 1/4 1/2 1

F-Stop

Shutter

Example: these pairs of aperture and shutter speed give equivalent exposure

If the exposure is too bright/dark, may need to adjust f-stop and/or shutter up/down.

(วႮ)

Page 32: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

Fast and Slow Photography

Page 33: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

High-Speed Photography

Normal exposure = extremely fast shutter speed x (large aperture and/or high ISO)

33

Harold EdgertonMark Watson

Slide courtesy L. Waller

Page 34: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

High-Speed Photography

34 Harold Edgerton

Page 35: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Long-Exposure Photography

35https://www.demilked.com/best-long-exposure-photos/

Page 36: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Long-Exposure Photography

36

https://www.demilked.com/best-long-exposure-photos/

Page 37: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Long-Exposure Photography

37

https://www.demilked.com/best-long-exposure-photos/

Page 38: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

Thin Lens Approximation

Page 39: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Real Lens Designs Are Highly Complex

39

[Apple]

Page 40: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Real Lens Elements Are Not Ideal – Aberrations

40

Real plano-convex lens (spherical surface shape). Lens does not converge rays to a point anywhere.

���

����

����.

������

���

����

����

������

������

����

system

.�

emostc

lassical

exam

pleof

thismight

bethehistorical

sequ

ence

ofim

prove-

ments

intheoriginal

photograph

icob

jective,

aland

scapelens

desig

nedby

Wollaston

in����

[Kingslake

����].Itconsisted

ofasin

gle-elem

entm

enisc

uslens

with

concavesid

eto

anaperture

stop.In����,C

hevalierimproved

thedesig

nby

splittin

gthemenisc

usinto

acementeddo

ubletc

ompo

sedof

a�int

glasslens

andacrow

nglasslens.Finally,in����,

Dallm

eyer

split

thec

rownlens

again,

placingon

eoneither

sideo

fthe

central�

intlens.

Todaytheprocesso

fcorrectingaberratio

nsby

combining

glasse

lementshasb

eencar-

riedtoremarkablee

xtremes.Z

oom

lensesprovidep

erhaps

them

ostd

ramaticillustrationof

Figure

�.�:Spheric

alaberratio

n.

thisph

enom

enon

.Zoo

mingalens

requ

iresa

non-lin

ears

hi�

ofatleastthree

grou

psof

lens

elem

entsrelativ

etoon

eano

ther,

makingitvery

challeng

ingto

maintainareason

able

levelo

faberratio

ncorrectio

nover

thez

oom

range.How

ever,the

con-

venience

oftheoriginalzoom

system

swas

sodesir

ablethatit

quicklylaun

ched

anintenseresearch

e�ortthatled

totheex-

trem

elysoph

isticated,b

utcomplex

desig

nform

sthat

wesee

today[M

ann����].Asa

nexam

ple,commod

ity��

mm

zoom

lenses

containno

fewer

than

��di�erent

glasselem

ents,and

somehave

asmanyas

��[D

ickerson

andLepp

����]!

Today,

allm

odernlens

desig

nworkiscompu

ter-aided[Smith

����],

where

desig

nform

sareiterativ

elyop

timized

byacompu

ter.

One

reason

forthe

largenu

mbersof

lens

elem

entsisthatthey

provideg

reaterdegreeso

ffreedom

forthe

optim

izertoachieve

thed

esire

dop

ticalqu

ality

[Kingslake

����].

�ischapterintrod

uces

anew

pure-so�

wareapproach

tocompensatingforlens

aberratio

nsa�

ertheph

otograph

istaken.

�isapproach

complem

entstheclassic

alop

tical

tech-

niqu

es.�

ecentralcon

cept

issim

ple:sin

cealight

�eld

camerarecordsthe

light

traveling

alon

gallraysinsidethecamera,wecanusethecompu

tertore-sortaberrated

rays

oflight

towhere

they

shou

ldideally

have

converged.

Digita

lcorrectionof

thiskind

improves

the

quality

of�n

alim

ages

byredu

cing

resid

ualaberrations

presentinanygivenop

ticalrecipe.

Fors

implicity,thisc

hapter

assumes

alight

�eld

cameracon�

guredwith

theplenop

tic

Page 41: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Ideal Thin Lens – Focal Point

41

(1) All parallel rays entering a lens pass through its focal point. (2) All rays through a focal point will be in parallel after passing the lens. (3) Focal length can be arbitrarily changed (in reality, yes!).

Focal Length

Focal Point

Credit: Karen Watson

(ᆌᅩ)

Page 42: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

The Thin Lens Equation

42

zo zi

f f

zo � f

f=

f

zi � f

(zo � f)(zi � f) = f2

zozi � (zo + zi)f + f2 = f2

zozi = (zo + zi)f

1

f=

1

zi+

1

zo

Page 43: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Gauss’ Ray Diagrams

43

Object Image

Parallel Ray

Focal Ray

Chief Ray

Page 44: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Gauss’ Ray Tracing Construction

44

zo zi

f f

What is the relationship between conjugate depths ? zo, zi

Page 45: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Gauss’ Ray Tracing Construction

45

f

hi

ho

zo � f=

hi

f

ho

f=

hi

zi � f

ho

fho

zo � f=

hi

f

ho

hi

ho

f=

hi

zi � f

Page 46: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Gauss’ Ray Tracing Construction

46

ho

f=

hi

zi � fho

hi=

f

zi � f

ho

zo � f=

hi

fho

hi=

zo � f

f

zo � f

f=

f

zi � f

(zo � f)(zi � f) = f2

zozi � (zo + zi)f + f2 = f2

zozi = (zo + zi)f

1

f=

1

zi+

1

zo

Object / image heights factor out - applies to all rays

ho

zo � f=

hi

fho

hi=

zo � f

f

ho

f=

hi

zi � fho

hi=

f

zi � f

zo � f

f=

f

zi � f

(zo � f)(zi � f) = f2

zozi � (zo + zi)f + f2 = f2

zozi = (zo + zi)f

1

f=

1

zi+

1

zo

zo � f

f=

f

zi � f

(zo � f)(zi � f) = f2

zozi � (zo + zi)f + f2 = f2

zozi = (zo + zi)f

1

f=

1

zi+

1

zo

zo � f

f=

f

zi � f

(zo � f)(zi � f) = f2

zozi � (zo + zi)f + f2 = f2

zozi = (zo + zi)f

1

f=

1

zi+

1

zo

zo � f

f=

f

zi � f

(zo � f)(zi � f) = f2

zozi � (zo + zi)f + f2 = f2

zozi = (zo + zi)f

1

f=

1

zi+

1

zo

Newtonian Thin Lens Equation

Gaussian Thin Lens Equation

Page 47: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Thin Lens Demonstration

47

http://graphics.stanford.edu/courses/cs178-10/applets/gaussian.html

Page 48: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

Defocus Blur

Page 49: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Computing Circle of Confusion (CoC) Size

49

d!

Circle of confusion is proportional to the size of the aperture

zo zi

CA

Focal Plane Sensor PlaneObject Image

z0s zs

C

A=

d0

zi=

|zs � zi|zi

Page 50: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

CoC vs. Aperture Size

50

A side note: hilarious Google translate…

Page 51: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Revisiting F-Number (a.k.a. F-Stop)

• Formal definition: The f-number of a lens is defined as the focal length divided by the diameter of the aperture

• Common f-stops on real lenses: 1.4, 2, 2.8, 4.0, 5.6, 8, 11, 16, 22, 32

• An f-stop of 2 is sometimes written f/2, reflecting the fact that the absolute aperture diameter (A) can be computed by dividing focal length (f) by the relative aperture (N).

51

Page 52: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Example F-Stop Calculations

52

D = 50mm

f = 100mm

N = f/D = 2

D = 100mm

f = 200mm

N = f/D = 2

D = 100mm

f = 400mm

N = f/D = 4

Page 53: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Size of CoC is Inversely Proportional to F-Stop

53

C = A|zs � zi|

zi=

f

N

|zs � zi|zi

R. Berdan, canadiannaturephotographer.com

Page 54: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

Ray Tracing Ideal Thin Lenses

Page 55: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Examples of Renderings with Lens Focus

55

Pharr and Humphreys

Page 56: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Ray Tracing for Defocus Blur (Thin Lens)

56

(One possible) Setup: • Choose sensor size, lens focal length and aperture size • Choose depth of subject of interest zo

• Calculate corresponding depth of sensor zi

from thin lens equation

zo zi

x’

x’’’

x’’

Sensor

Subject plane

Page 57: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Ray Tracing for Defocus Blur (Thin Lens)

57

Rendering: • For each pixel x’ on the sensor (actually, film (ᚂᇆ)) • Sample random points x’’ on lens plane • You know the ray passing through the lens will hit x’’’

(because x’’’ is in focus, consider virtual ray (x’, center of the lens)) • Estimate radiance on ray x’’ -> x’’’

zo zi

x’

x’’’

x’’

Sensor

Subject plane

Page 58: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

Depth of Field

Page 59: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Depth of Field

• Depth of field is the range of object depths that are rendered with acceptable sharpness in an image

59

From London and Upton

Set circle of confusion as the maximum permissible blur spot on the image plane that will appear sharp under final viewing conditions

Page 60: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Circle of Confusion for Depth of Field

60

197

from subjects closer than “infinity”converge at a point in the focal plane.

Circle of confusionSince all lenses contain a certain amountof spherical aberration and astigmatism,they cannot perfectly converge rays from asubject point to form a true image point(i.e., an infinitely small dot with zero area).In other words, images are formed from acomposite of dots (not points) having acertain area, or size. Since the imagebecomes less sharp as the size of thesedots increases, the dots are called “circlesof confusion.” Thus, one way of indicatingthe quality of a lens is by the smallest dotit can form, or its “minimum circle ofconfusion.” The maximum allowable dotsize in an image is called the “permissiblecircle of confusion.”

Permissible circle of confusionThe largest circle of confusion which stillappears as a “point” in the image. Imagesharpness as sensed by the human eye isclosely related to the sharpness of theactual image and the “resolution” ofhuman eyesight. In photography, imagesharpness is also dependent on the degreeof image enlargement or projectiondistance and the distance from which theimage is viewed. In other words, inpractical work it is possible to determinecertain “allowances” for producing imageswhich, although actually blurred to acertain degree, still appear sharp to theobserver. For 35mm single lens reflexcameras, the permissible circle of confusionis about 1/1000~1/1500 the length of thefilm diagonal, assuming the image isenlarged to a 5”!7” (12 cm ! 16.5 cm)print and viewed from a distance of 25~30cm/0.8~1 ft. EF lenses are designed toproduce a minimum circle of confusion of0.035 mm, a value on which calculationsfor items such as depth of field are based.

Depth of fieldThe area in front of and behind a focusedsubject in which the photographed imageappears sharp. In other words, the depth ofsharpness to the front and rear of thesubject where image blur in the focalplane falls within the limits of thepermissible circle of confusion. Depth offield varies according to the lens’ focallength, aperture value and shootingdistance, so if these values are known, arough estimate of the depth of field can becalculated using the following formulas:

Front depth of field = d·F·a2/(f2 + d·F·a)Rear depth of field = d·F·a2/(f2 — d·F·a)f: focal length F: F number d: minimumcircle of confusion diametera: subject distance (distance from thefirst principal point to subject)

If the hyperfocal distance is known, thefollowing formulas can also be used:In general photography, depth of field ischaracterised by the following attributes:! Depth of field is deep at short focallengths, shallow at long focal lengths." Depth of field is deep at smallapertures, shallow at large apertures.# Depth of field is deep at far shootingdistances, shallow at close shootingdistances.$ Front depth of field is shallowerthan rear depth of field.

Depth of focusThe area in front of and behind the focalplane in which the image can bephotographed as a sharp image. Depth offocus is the same on both sides of theimage plane (focal plane) and can bedetermined by multiplying the minimum

circle of confusion by the F number,regardless of the lens focal length. Withmodern autofocus SLR cameras, focusingis performed by detecting the state offocus in the image plane (focal plane)using a sensor which is both opticallyequivalent (1:1 magnification) andpositioned out of the focal plane, andautomatically controlling the lens to bringthe subject image within the depth offocus area.

Hyperfocal distanceUsing the depth of field principle, as alens is gradually focused to farthersubject distances, a point will eventuallybe reached where the far limit of therear depth of field will be equivalent to“infinity.” The shooting distance at thispoint, i,e., the closest shooting distanceat which “infinity” falls within the depthof field, is called the hyperfocal distance.The hyperfocal distance can bedetermined as follows:

Thus, by presetting the lens to thehyperfocal distance, the depth of field willextend from a distance equal to half thehyperfocal distance to infinity. Thismethod is useful for presetting a largedepth of field and taking snapshotswithout having to worry about adjustingthe lens focus, especially when using aw i d e - a n g l elens. (Forexample, whenthe EF 20mmf/2.8 USM is setto f/16 and thes h o o t i n gdistance is setto the hyperfocal distance of ap-proximately 0.7m/2.3ft, all subjects withina range of approximately 0.4m/1.3ft fromthe camera to infinity will be in focus.)

Figure-15 Relationship Between the Ideal FocalPoint and the Permissible Circle ofConfusion and Depth of Field

Figure-16 Depth of Field and Depth of Focus

Photo-1 Hyperfocal Length SetCondtion

Hyperfocaldistance =

f2 f: focal length F: F number

d•F number d: minimum circle of confusion diameter

Figure-17 Relationship Between Depth ofFocus and Aperture

Lens Ideal focal point

Depth of focus

Front depthof field Rear depth

of field

Permissible circle of confusion

Near point limiting�distance =

hyperfocal distance !shooting distance�

hyperfocal distance +�shooting distancehyperfocal distance !shooting distance�

hyperfocal distance -�shooting distance

(Shooting distance: Distance from focal plane to subject)

Far point limiting�distance =

Depth of field Depth of focus

Minimum circle of confusion

Far point Near point

Reardepthof field

Front depth of field

Near point distance

Far point distance

Subject distance

Shooting distance

Focal plane

Reardepthof focus

Frontdepth offocus

Imagedistance

50mm f/1.8

f/1.8

Aperture

Depth of focus at�maximum aperture

Permissible�circle of confusion

f/5.6

Aperture

Depth of�focus at f/5.6

Permissible�circle of confusion

[Canon, EF Lens Work III]

i.e. depth range in a scene where the corresponding CoC is considered small enough

Page 61: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

Depth of Field (FYI)

61

f f

DF

DN dN

dF

Depth of field Depth of focus

Circle of confusion, C

DS dS

A

DF =DSf2

f2 �NC(DS � f)DN =

DSf2

f2 +NC(DS � f)

DOF = DF �DN

dN � dSdN

=C

AdS � dF

dF=

C

A

N =f

D1

DF+

1

dF=

1

f1

DS+

1

dS=

1

f1

DN+

1

dN=

1

f

N =f

A

dN � dSdN

=C

AdS � dF

dF=

C

A

N =f

D1

DF+

1

dF=

1

f1

DS+

1

dS=

1

f1

DN+

1

dN=

1

f

Page 62: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

GAMES101 Lingqi Yan, UC Santa Barbara

DOF Demonstration (FYI)

62

http://graphics.stanford.edu/courses/cs178/applets/dof.html

Page 63: GAMES101 Lecture 19 - sites.cs.ucsb.edulingqi/teaching/... · Constant Exposure: F-Stop vs Shutter Speed • Photographers must trade off depth of field (?) and motion blur for moving

Thank you!(And thank Prof. Ren Ng for many of the slides!)