Game Development Reference
In-Depth Information
Figure 14.4 A morph target set.
Creating keyframes for the morph targets
To be useful we need a way to blend the targets together. One method
involves assigning a blend level to each of the morph targets. If we have
five targets and the blend level for each is set to zero, then we will have
the base geometry displayed. If target A is ramped up to 100 per cent and
all the other targets are set to zero blend, then we want the displayed
geometry to be entirely as described by target A. If, however, target A is
at 50 per cent and B is at 50 per cent, then we want to display a mesh that
is part A and part B. Since each 'MORPHITEM' has a level member in the
structure, we can set this level for each morph target. Suppose we have
the situation given in Table 14.1.
We would expect to see a mesh that was mainly influenced by the
vertex locations in the 'Angry' target, but a little influenced by the vertex
locations in the 'Sad' target. The method adopted is to sum the current
levels. If the sum is greater than 1.0 or 100 per cent, then we ignore the
base mesh position and divide all the current levels by the total, so that
the value of all the levels combined will represent a sum to 1.0 or 100 per
cent. If the value is less than 1.0, then we give a value to the base mesh
that pulls the total level up to 1.0. To show the mesh as influenced by the
values given in Table 14.1, we calculate the total level as 0.3 + 0.8 = 1.1.
Since this value is greater than 1.0, we divide each morph target level by
Table 14.1 Sample morph levels
Target
Level
MORPHITEM index
Smile
0.0
1
Sad
0.3
2
Angry
0.8
3
Surprised
0.0
4
 
Search Nedrilad ::




Custom Search