Graphics Reference
In-Depth Information
Figure 9.6.
Ripples by bump mapping.
dy
line segment has slope
m
d
=
, we can express the slope as the vector [1,
m
], as
shown in the diagrams below.
The normal to any line with slope
m
has slope
1
−
m
(the negative recipro-
cal of the original slope), so the normal can be expressed as the vector (-
m
, 1.).
Notice that the dot product is (1,
m
) × (−
m
,1) = 0, as must be true if the vectors
are perpendicular. So if we want to model a moving “bump” on the surface
with height
a
, period
P
d
, and time
t
, we have
2
π
x
z a
=− ∗
cos
−
2
π
t
P
d
and its slope, or derivative with respect to
x
, is
dz
dx
2
π
2
π
x
=∗ ∗
a
sin
−
2
π
t
P
P
d
d
so the vector slope,
s
, is
2
π
2
π
x
s
=
10
.,
.,
a
∗
∗
sin
−
2
π
t
.
P
P
d
d