Graphics Reference
In-Depth Information
of
k
; let those values be denoted
x
∗
(
t
)
. Assume that the same processing will
happen to all vertices; we'll return to ways of accomplishing that in a moment.
If we choose a
sample-and-hold
strategy for the intermediate frames:
Let
t
0
=
t
/
p
p
(35.1)
x
(
t
)=
x
∗
(
t
0
)
,
(35.2)
then the animation will play back at the correct rate. The expression for
t
0
in
Equation 35.1 is a common idiom. It rounds
t
down to the nearest integer multiple
of
p
.
Inline Exercise 35.1:
Closely related to sample-and-hold is
nearest-neighbor,
where we round
t
to the nearest integer multiple of
p
.
(a) Write an expression for the nearest-neighbor strategy.
(b) Explain why sample-and-hold, given values at integer multiples of
p
,is
the same as nearest-neighbor applied to the same values, each shifted by
p
2. Because of this close relation, the terms are often informally treated as
synonyms.
/
As shown in Figure 35.6, the result of sample-and-hold interpolation will not
be smooth. At 60 Hz playback, we'll see a single pose hold for 15 frames and then
the character will instantaneously jump to the next key pose. We can improve this
by linearly interpolating between frames:
Let
t
0
=
t
/
p
p
;
t
1
=
t
0
+
p
;
α
=(
t
−
t
0
)
/
p
and
(35.3)
)
x
∗
(
t
0
)+
x
∗
(
t
1
)
.
x
(
t
)=(
1
−α
α
(35.4)
The linear interpolation avoids the jumps between poses so that positions
appear to change smoothly, as shown in Figure 35.7.
This discussion was for a single vertex. There are several methods for extend-
ing the derivation to multiple vertices; here are three. A straightforward extension
is to apply equivalent processing to each element of an array of vertices. That is,
to let
x
i
(
t
)
be the position of the vertex with index
i
and then let
x
i
(
t
)=
x
i
(
t
)
y
i
(
t
)
z
i
(
t
)
T
.
(35.5)
x
(
t
)
x
(1
/
4)
x
(2
/
4)
x
(3
/
4)
t
Figure 35.7: Linear interpolation of position over time of a point on a character's hand.