Professional Documents
Culture Documents
Last Time?
Ray representation
Generating rays from eye point / camera
orthographic camera
perspective camera
Outline
Intro to Transformations
Classes of Transformations
Representing Transformations
Combining Transformations
Transformations in Modeling
Adding Transformations to our Ray Tracer
What is a Transformation?
Maps points (x, y) in one coordinate system to
points (x', y') in another coordinate system
x' = ax + by + c
y' = dx + ey + f
For example, IFS:
Simple Transformations
Can be combined
Are these operations invertible?
Yes, except scale = 0
MIT EECS 6.837, Durand and Cutler
Outline
Intro to Transformations
Classes of Transformations
Representing Transformations
Combining Transformations
Transformations in Modeling
Adding Transformations to our Ray Tracer
Rigid / Euclidean
Translation
Identity
Rotation
Similitudes
Rigid / Euclidean
Translation
Identity
Rotation
Isotropic Scaling
Linear Transformations
Similitudes
Linear
Rigid / Euclidean
Translation
Identity
Rotation
Scaling
Isotropic Scaling
Reflection
Shear
Linear Transformations
L(p + q) = L(p) + L(q)
L(ap) = a L(p)
Similitudes
Linear
Rigid / Euclidean
Translation
Identity
Rotation
Scaling
Isotropic Scaling
Reflection
Shear
Affine Transformations
preserves
parallel lines
Affine
Similitudes
Linear
Rigid / Euclidean
Translation
Identity
Rotation
Scaling
Isotropic Scaling
Reflection
Shear
Projective Transformations
preserves lines
Projective
Affine
Similitudes
Linear
Rigid / Euclidean
Translation
Identity
Rotation
Scaling
Isotropic Scaling
Perspective
Reflection
Shear
Perspective Projection
Outline
Intro to Transformations
Classes of Transformations
Representing Transformations
Combining Transformations
Transformations in Modeling
Adding Transformations to our Ray Tracer
p' =
a
d
b
e
x
c
+
y
f
Mp + t
Homogeneous Coordinates
Add an extra dimension
in 2D, we use 3 x 3 matrices
In 3D, we use 4 x 4 matrices
c d
g h
k l
o p
p' =
Mp
MIT EECS 6.837, Durand and Cutler
x
y
z
w
x'
=
y'
p' =
a
d
b
e
Homogeneous formulation
x
c
+
y
f
Mp + t
x'
=
y
1
p' =
a b c
d e f
0 0 1
Mp
x
y
1
Homogeneous Coordinates
Most of the time w = 1, and we can ignore it
x'
y'
z'
1
a
e
i
0
b c
f g
j k
0 0
d
h
l
1
x
y
z
1
Homogeneous Visualization
Divide by w to normalize (homogenize)
W = 0? Point at infinity (direction)
(0, 0, 1) = (0, 0, 2) = w = 1
(7, 1, 1) = (14, 2, 2) =
(4, 5, 1) = (8, 10, 2) =
w=2
Translate(c,0,0)
y
x'
y'
z'
10
1
0
0
0
p'
0
1
0
0
0
0
1
0
tx
ty
tz
1
x
y
z
1
Scale(s,s,s)
p'
Isotropic (uniform)
scaling: sx = sy = sz
p
q
q'
x
x'
y'
z'
1
sx
0
=
0
0
0
sy
0
0
0
0
sz
0
0
0
0
1
x
y
z
1
Rotation
ZRotate()
p'
About z axis
p
x
x'
y'
z'
1
cos -sin
sin cos
0
0
0
0
0
0
1
0
0
0
0
1
x
y
z
1
Rotation
Rotate(k, )
0 x
0 y
0 z
1 1
Storage
Often, w is not stored (always 1)
Needs careful handling of direction vs. point
Mathematically, the simplest is to encode directions
with w=0
In terms of storage, using a 3-component array for
both direction and points is more efficient
Which requires to have special operation routines for
points vs. directions
Outline
Intro to Transformations
Classes of Transformations
Representing Transformations
Combining Transformations
Transformations in Modeling
Adding Transformations to our Ray Tracer
(2,2)
Scale(2,2)
Translate(3,1)
(5,3)
(3,1)
(0,0)
(0,0)
1 0 3
0 1 1
0 0 1
2 0 0
0 2 0
0 0 1
2 0 3
0 2 1
0 0 1
Non-commutative Composition
Scale then Translate: p' = T ( S p ) = TS p
(1,1)
(2,2)
Scale(2,2)
Translate(3,1)
(5,3)
(3,1)
(0,0)
(0,0)
Translate(3,1)
(4,2)
(3,1)
Scale(2,2)
(0,0)
(6,2)
Non-commutative Composition
Scale then Translate: p' = T ( S p ) = TS p
TS =
1 0 3
0 1 1
0 0 1
2 0 0
0 2 0
0 0 1
2 0 3
0 2 1
0 0 1
2 0 0
0 2 0
0 0 1
1 0 3
0 1 1
0 0 1
2 0 6
0 2 2
0 0 1
Today
Intro to Transformations
Classes of Transformations
Representing Transformations
Combining Transformations
Transformations in Modeling
Adding Transformations to our Ray Tracer
Transformations in Modeling
Scene Description
Scene
Camera
Lights
Background
Materials
(much more
next week)
Objects
Class Hierarchy
Object3D
Cylinder
Sphere
Group
Plane
Cone
Triangle
Ray-group intersection
Recursive on all sub-objects
Adding Materials
Group {
numObjects 3
Material { <BLUE> }
Group {
numObjects 3
Box { <BOX PARAMS> }
Box { <BOX PARAMS> }
Box { <BOX PARAMS> } }
Group {
numObjects 2
Material { <BROWN> }
Group {
Box { <BOX PARAMS> }
Box { <BOX PARAMS> }
Box { <BOX PARAMS> } }
Group {
Material { <GREEN> }
Box { <BOX PARAMS> }
Material { <RED> }
Sphere { <SPHERE PARAMS> }
Material { <ORANGE> }
Sphere { <SPHERE PARAMS> } } }
Material { <BLACK> }
MIT EECS
Durand and Cutler
Plane { <PLANE PARAMS>
} 6.837,
}
Adding Transformations
Cylinder
Sphere
Cone
Plane
Group
Triangle
Transform
Nested Transforms
p' = T ( S p ) = TS p
Translate
Scale
Translate
Scale
same as
Sphere
Sphere
Transform {
Transform {
Translate { 1 0.5 0 }
Translate { 1 0.5 0 }
Transform {
Scale { 2 2 2 }
Scale { 2 2 2 }
Sphere {
Sphere {
center 0 0 0
center 0 0 0
radius 1 } }
MIT}EECS
radius 1
} }6.837, Durand and Cutler