Marc Schra enberger 04.26 - University of Rhode Island
Transcript of Marc Schra enberger 04.26 - University of Rhode Island
24.2 Image Formation
Marc Schraffenberger
04.26.04
Outline
• Definitions
• Orthographic Projection
• Perspective Projection
• Vanishing Points
• Scaled Orthographic Projection
• Depth of Field and Lens Systems
• Light and Ray Tracing
• Diffuse Reflection
• Specular Reflection
Definitions
Scene
Image Plane
Pixels
Example Scene Description
( 2, 5, 5 ) ( −2, 5, 25 )( 0, 5, 15 )
z
x
Orthographic Projection
Orthographic Projection
• In orthographic projections, parallel lines remain parallel
after the projection.
• Leave (x, y) coordinates the same, but set z = 0
• The transform drops from three to two dimensions,
resulting in no way to retrieve the dropped dimension.
• The red sphere at (2, 5, 5)scene → (2, 5)image.
Orthographic Projection
Image plane
y, Y
x, X
Z
Perspective Projection
Perspective Projection
y
(x, y)
Z
(X, Y, Z)Image plane
f
Lens center
Y
Xx
Perspective Projection Equations
• For any point, p, in world space we can project it onto
the image plane, yielding a new point q.
• Derive perspective projection equations by using similar
triangles
qx = −fpx
pz
qy = −fpy
pz
Perspective Projection Example
The red sphere is at (2, 5, 5)scene and the camera’s focal
length, f , is 1. We can now use the perspective project
equations to get the image coordinates.
qx = −fpx
pz
= −2
5= −0.4
qy = −fpy
pz
= −5
5= −1.0
Perspective Projection Matrix
Typically projections as represented in matrix form. We can
the define the perspective transformation matrix, Pp as
Pp =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 − 1
f0
Perspective Projection Matrix Example
Using the perspective transformation matrix we can easily
obtain the image space coordinates of the red sphere.
q = Ppp =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 −1
10
2
5
5
1
=
2
5
5
−5
⇒
−0.4
−1.0
−1.0
1.0
The last step divides the entire vector by the w-component to
get a 1 in the last component. (required for homogeneous
coordinates)
Vanishing Points
Parallel lines converge to a vanishing point under perspective
projection. To show this, define a line as a set of points
(px + λdx, py + λdy, pz + λdz) which passes through point p
with direction d and λ varying between −∞ and +∞.
The projection of a point from this line onto the image plane
is
(fpx + λdx
pz + λdz
, fpy + λdy
pz + λdz
).
Thus the vanishing point becomes v∞ = (f dx
dz, f
dy
dz), showing
that lines with the same direction have a common vanishing
point.
Scaled Orthographic Projection
If an object is shallow compared with its distance from the
camera, we can approximate its perspective projection by
using scaled orthographic projection.
• If the depth points of the object varies in some range
Z0 ± ∆Z, with ∆Z � Z0
• We can set a scaling factor s = fZ0
• The equations for the projection of the scene coordinates
onto the image plane are x = sX and y = sY
Since this is only an approximation, it should only be used
for objects with little depth variation.
Perspective Projection
Depth of Field
Perspective Projection with a Lens
So far our projections have been for non-lens cameras. Once
a lens is introduced, we enable more light to enter the image
plane. Because of this not all objects can be in-focus. If an
object is at distance Z it will be in-focus at a fixed distance
from the lens Z ′ such that
1
Z+
1
Z ′=
1
f
Because of this only a range of depths will be in-focus, which
is called the depth of field.
Perspective Projection with a Lens
Also note that since the object’s distance, Z, is typically
much larger then the image distance Z ′ or f . Because of this
we can approximate by
1
Z+
1
Z ′≈
1
Z ′⇒
1
Z ′≈
1
f.
Therefore since Z ′ ≈ f , we can still use perspective projection
with a lens system.
Light
• The study of how light interacts with objects is crucial to
image formation. Without light, all images would be
completely dark.
• The intensity of a pixel in an image is proportional to the
amount of light directed at the camera from the surface
of the projecting object.
• The amount of light directed from the surface depends on
the reflectance properties of the surface, the light sources
in the scene, and the reflectance properties of other
objects.
Ray Tracing
C
A
B
E
D
F
Ray Tracing
A - ray goes directly to camera
B - ray misses everything and goes off to ∞
C - ray bounces off mirror and into the camera
D - ray hits a diffuse surface and generates new rays
E - ray hits a partially transparent surface generates a
transmitted ray and reflected ray
F - ray bounces off mirror and hits a surface that absorbs it
Diffuse Reflection
• When light hits a diffuse surface it is absorbed into the
surface
• Depending on the light color and material color, they
may be completely absorbed or scattered in a reflection
direction.
• The probability of the reflection direction is equal for all
directions
• This means it is independent of the camera’s position or
direction
Diffuse Reflection
l
p
n
o
Lambert’s Law:
reflected light is deter-
mined by the cosine be-
tween the surface normal n
and the light vector l.
Idiff = (n·l)mdiff⊗sdiff
Diffuse Reflection Example
light source = (0.0, 10.0, 10.0)
surface point = (2.0, 5.0, 5.0)
surface point normal = (0.0, 1.0, 6.0)
light color = (0.6, 0.1, 0.3)
material color = (0.5, 0.25, 0.25)
Ip = ((0, .16, .98) · (−.27, .68, .68))(0.5, 0.25, 0.25) ⊗ (0.6, 0.1, 0.3)
= 0.783(0.5, 0.25, 0.25) ⊗ (0.6, 0.1, 0.3)
= (0.2349, 0.0196, 0.0587)
Specular Reflection
Specular Reflection
• Specular reflection makes a surface look shiny by creating
highlights
• Helps viewer understand curvature of the surface
• It requires knowledge of the view vector, making it view
dependent
Specular Reflection
o
l
p
nh
v
The following specular
equation was presented
by Blinn, which calculates
a normalized half vector
between l and v
Ispec = (n · h)mspec
h =l + v
‖l + v‖
Summary
• Definitions
• Orthographic Projection
• Perspective Projection
• Vanishing Points
• Scaled Orthographic Projection
• Depth of Field and Lens Systems
• Light and Ray Tracing
• Diffuse Reflection
• Specular Reflection
Questions?