# User manual | Rendering Algorithms: Camera Models and High Dynamic Range

```Rendering Algorithms:
Camera Models and High Dynamic
Range
g Imaging
g g
Spring
p g 2010
Matthias Zwicker
Today
• (More) realistic camera models
• High dynamic range & tone mapping
Realistic camera models
• So far: ray tracing using the pinhole model
Pinhole cameras
Pinhole cameras
Problems
Pinhole cameras
Problems
• Small pinhole gathers little light, requires
long exposure
• Larger pinhole reduces sharpness
Lenses
• Gather more light
• Need to be focused
Lens
Lenses
Pinhole
Lens
6 sec. exposure
0.01 sec exposure
Thin lens model
• Theoretical model for well-behaved
lenses
http://en.wikipedia.org/wiki/Thin_lens
• Properties
p
– All parallel rays
converge at focal
length
– Rays through the
center are not
deflected
Thin lens model
• How are arbitrary rays deflected when
passing through a thin lens?
Thin lens model
Thin lens model
• Similar triangles
Thin lens model
• More similar triangles
Thin lens model
• Thin lens formula
• All rays passing through a single point on
a plane at distance
in front of the lens
will pass through a single point at
distance
behind the lens
Thin lens model
• Focus at infinity:
Film
plane
• Closest focusing
distance:
Object
Thin lens model
• Out of focus film plane results in spherical
blur
Outt off ffocus
O
film planes
S h i l bl
Spherical
blur
Depth of field
• Blurriness of out of focus objects depends
on aperture size
• “Depth of field”: depth range that
pp
reasonablyy sharp
p in image
g
appears
http://en.wikipedia.org/wiki/Depth_of_field
Aperture
Circle of confusion
• Also called „blur circle“
http://en.wikipedia.org/wiki/Circle_of_confusion
• Calculation
l l
d
c
–
–
–
–
Lens focused at S1
Object at S2
Aperture A
Focal length f
sensor
Depth of field
Ray tracing using a thin lens model
• Place image plane at distance D from lens plane
• Generate primary rays with random origin on
l
lens
aperture
t
Pinhole
Thin lens
Object
in focus
Aperture
Pi
Primary
rays Image
I
plane
l
Primary
P
i
rays Image
I
plane
l
for one pixel
Camera parameters
Typical
T
i l SLR llens
• Focal length
g
– E.g., 35mm
• f-number
f
b (f
(focall length)/(aperture)
l gth)/(
t )
– E.g, f-3.5
• Aperture is (focal length)/(f-number)
– E.g.
E g 10mm
• Depth of field effects only for very short
distances distances, < 5m
Camera parameters
Typical SLR lens
• Field of view depends on focusing
distance
• Film
Fil size
i iis 36
36mm x 24
24mm
• Focus
ocus at infinity,
ty, vertical
ve t cal field
eld o
of vview
ew iss
Other lens effects
• Aberrations
– Chromatic aberration
– Spherical aberration
• Distortion
Di t ti
– Barrel distortion
– Pincushion distortion
• Etc.
Etc
http://en.wikipedia.org/wiki/Lens_%28optics%29
Barrel & pincushion
distortion
More realistic camera models
• “A realistic camera model for computer
graphics”,
g
p
, Kolb,, Mitchell,, Hanrahan
• Lens distortion
• Exposure,
E
motion
ti bl
blur
[Kolb et al.]
Full simulation
Thick lens
approximation
Thin lens
approximation
Today
• (More) realistic camera models
• High dynamic range & tone mapping
HDR and tone mapping
• HDR: high dynamic range
• Dynamic range: ratio of largest over
smallest intensity value in image
• Dynamic
D
i range iin reall environments
i
t often
ft
larger than range of camera sensor
• Dynamic range of rendered images often
larger than range of display
HDR photography
• Acquire several images with different
p
exposures
• Recover a HDR intensity for each pixel
[Wikipedia]
HDR photography
• Steve Mann
http://genesis.eecg.toronto.edu/wyckoff/index.html
• Paul Debevec
http://www.debevec.org/Research/HDR/
p
g
• Mitsunaga, Nayar, Grossberg
Tone mapping
•C
Compress d
dynamic
i range off iimage without
ith t
losing detail
[Wikipedia]
Linear scaling
• Map fix luminance value to white using
linear scaling
– Examples: different values mapped to white
Tone mapping
• Intuition: want to reduce brighter values
more than darker ones
• Need non
non-linear
linear scaling
– Subjective, no „correct“ way to do it
– See http://de.wikipedia.org/wiki/Tone
p
p
g
_Mapping
pp g
Output luminance
Linear scaling
Non-linear scaling
Input luminance
Contrast preserving non-linear scaling
• Tries to preserve contrast visibility
– Set output luminance such that noticeable
contrast differences are same as in input
– Based on model of human visual system
– Global scale factor
• Details
– “A contrast based scale factor for luminance
displa ” Ward
display”,
Ward,
1994
– PBRT book
Spatially varying non-linear scaling
• Determine different scale factors on per
pixel basis
– Extension
E
i off previous
i
method
h d
• “A tone mapping
pp g algorithm
g
for high
g
contrast images”, Ahiskmin, 2002
halos
Spatially varying non-linear scale
• Based on „Photographic Tone Reproduction for
Digital Images“, Reinhard et al. 2002
• Inspired by photography
• Simple & often works well
• L = pixel luminance, Lwhite = desired lum. of „white“
• Given RGB colors,
colors
luminance is
0 21 *R + 0.71
0.21
0 71 *G + 00.07*
07* B
http://en.wikipedia.org/wiki/Luminance_%28relative%29
Multi-scale methods
• Reduce contrast of low-frequencies
low frequencies
• Keep high frequencies, preserves details
Multi-scale methods
• Problem: halos
Edge-preserving filtering
• Do not blur across edges
• Non-linear filtering (not a convolution)
Bilateral filter
• Tomasi and Manduchi 1998
http://www.cse.ucsc.edu/~manduchi/Papers/ICCV98.pdf
Tone mapping with the bilateral filter
Tone mapping with the bilateral filter
• “Fast Bilateral Filtering for the Display of
High-Dynamic-Range
g
y
g Images”,
g , Durand et
al., 2002
• Overview of tone mapping operators
http://de.wikipedia.org/wiki/Tone Mapping
http://de.wikipedia.org/wiki/Tone_Mapping
• Comparison