Tải bản đầy đủ (.pdf) (30 trang)

Animating Real- Time Game Characters-P5 ppt

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (795.08 KB, 30 trang )

108
Animating Real-Time Game Characters
FIGURE
3.25 Assign
all the
upper
arm
vertices
to the
UpperArm link.
(think knee and thigh). Vertices that are farther above the elbow will be
less influenced by the forearm, and vertices below the elbow will be less
influenced by the upper arm.
FIGURE
3.24
The
Initial
Skeletal Pose
option helps you go from an animated
to unanimated state.
Chapter 3 Weighting a Character Using Manual Vertex Assignment 109
Whenever it's a certainty that two links will be influencing a set of vertices like the
elbow, go ahead and assign them all an equal weighting (1 to the parent link and
1 to the child link). Of course, these values won't stay that way for all the vertices,
but it's a quick way to assign them to the right links simultaneously, causing the
default Currently Assigned Links Only to be a boon and not a handicap when
tweaking the values.
Zoom in on the elbow area, and only select those vertices that make
up the elbow. Bring up the Type-In Weights dialog box, click All Links,
and assign the vertices to Betty R Forearm by clicking on it and typing in
1 (the vertices will turn dark green). Toggle Initial Skeletal Pose back and


forth by unchecking and checking its box to see the effects the weighting
change has on the elbow (Figure 3.26).
FIGURE
3.26
The
elbow
here
has
equal
influence
on
both
the
UpperArm
and
Forearm
links.
Unfortunately, the Forearm link does not immediately follow the UpperArm link
in the Type-In Weights dialog box. Several links that are children to the Forearm
appear first. Be careful not to accidentally assign weighting to a Hand link when
you think you're assigning it to the Forearm (Figure 3.27)!
While the weighting doesn't look bad, giving all of the vertices equal
influence from both links detracts from the intent of the geometry, which
110
Animating Real-Time Game Characters
FIGURE3.27 Beware the confusing out-of-order
Forearm link.
is to portray a thick elbow pad. Therefore, a few adjustments need to be
made. By toggling the Initial Skeletal Pose box on and off, you can get a
rough feel for what the values of the vertices should be changed to. For

example, the vertices at the top of the elbow need to be influenced less by
the forearm so the elbow can retain more of its shape, but the vertices
at the bottom of the elbow don't need to be changed as much. Turn your
Initial Skeletal Pose back on, and try the values shown in Figure 3.28 for
the elbow area.
Now when the elbow is bent, it looks better and keeps the shape of
the elbow pad intact. (Figure 3.29).
That solution solves the problem with the back of the elbow, but the
front of the joint (the bottom of the bicep area) needs to be tweaked as
well. With a weighting of 1 and 1, the arm crimps enough to make the
bleep shrink, instead of remaining the same or bulging. However, if you
bias the vertices more toward the UpperArm link, the forearm geometry
will look strange (Figure 3.30).
A solution to the forearm deforming the way it does is to lessen the
contrast of the elbow juncture; transfer some of the influence from
the forearm vertices over to the UpperArm link. It doesn't have to be
much, and can vary from character to character. Select the three vertices
at the top of Betty's arm in the bent position, lock them, and add the
Betty R UpperArm link to the links that influence the vertices. A value of
0.1 should work fine (Figure 3.31).
Chapter 3 Weighting a Character Using Manual Vertex Assignment 111
FIGURE
3.28
The
elbow
needs
to be
biased more toward
the
UpperArm link.

FIGURE
3.29
The
elbow
looks
better
with
the new
weighting
values.
112 Animating Real-Time Game Characters
FIGURE3.30
Biasing
the
front
of the
elbow
joint
to the
UpperArm
link
causes
a
strange
deformation.
FIGURE
3.31
Adding
the
UpperArm

link
to
links
that
influence
these vertices helps deform
the forearm better.
Chapter 3 Weighting a Character Using Manual Vertex Assignment
113
This juggling of weighting influence between adjoining links is neces-
sary to get around the limitation, which is a drawback of most generic
weighting algorithms found in most programs like Physique. Only with a
true "sliding skin" weighting system can areas like elbows, knees, wrists,
ankles, necks, and even shoulders and hips be 100 percent accurate in
the deformation of polygonal skin. However, keep in mind that this only
applies to real-time games; movies featuring CG-rendered characters em-
ploy all kinds of complex skeletal and musculature algorithms to simulate
skin and muscle movement.
Working on the Hand and Fingers
While most real-time game characters have mitts for fingers and clubs for
fists, Betty has the full use of five digits on her right hand. The weighting
for wrists is somewhat similar to that for ankles; select the vertices at the
joint, and give them equal influence by both Forearms and any of the in-
ternal Hand links.
To avoid too extreme a deformation at the wrist area, sometimes it's a good idea to
build your character with the palms facing forward instead of downward. This
may be as simple as turning the hand geometry, and then turning any bad edges
(Figure 3.32).
The fingers need to share influence between links at the knuckles.
Starting at the end link of the finger, and working your way towards the

FIGURE
3.32 Sometimes it's
the
geometry rather
than
the
weighting
that needs to be tweaked to ensure proper deformation.
114
Animating Real-Time Game Characters
hand, select and assign the vertices to each link along the way (including
all knuckle vertices), locking them as you go (Figure 3.33).
FIGURE
3.33
Assign
the
vertices
of the
hand
by
starting
with
the
fingers.
As you can see in Figure 3.33, the vertices highlighted in Group 1 are
assigned to Link A. Vertices in Group B are assigned to Link B, and those
in Group 3 are assigned to Link C. The quickest and easiest way to com-
plete the weighting is to go back and select only the knuckle vertices, and
share influence with the link that is the parent of the assigned link.
Whenever the Type-In Weights dialog box is brought up and All Links is chosen,

the link to which the selected vertices are assigned will automatically be high-
lighted, to make it easier to see against all the other links. However, when the link
selected is far enough down the overall list, character studio displays it by dropping
it to the bottom of the display window. By assigning vertices to the end link of the
fingers, and moving inwards towards the parent, the parent link that needs to
share influence over the vertices selected will be visible and on top of the selected
link when the list of links is displayed. If the vertices had been assigned to the par-
ent first, the child would be below the displayed list, and you would have to scroll
down to see the child of the selected link (Figure 3.34).
Chapter 3 Weighting a Character Using Manual Vertex Assignment
115
FIGURE
3.34 When
typing
in
values
for a
parent-child
set of
links,
assign
the
vertices to the child first, not the parent.
Character studio duplicates the naming of links so that each character
can have a number of Hand links. The best way to tell them apart is to
look below each link in the list of links. For Betty's uppermost knuckles,
share influence with the Hand link above the link the vertices have been
assigned to.
Often, when weighting vertices by hand, you 'II select a set, enter their values with
the proper links, and then select another set, keeping the Type-in Weights dialog

box open all the while. One quick way to isolate a link when "offscreen" is to toggle
back and forth between displaying All Links and Currently Assigned Links Only.
Doing this immediately lines up the selected vertices' link at the bottom of the long
list and saves you from scrolling up or down to find it.
For the thumb, rotate your view so you can see it in profile, and se-
lect and assign its vertices (Figure 3.35).
All the vertices in Group 1 are assigned to Link A, Group 2 to Link B,
and Group 3 to Link D. Share influence with the proper links, and the
thumb is weighted. The vertices in Group 3 that are assigned to the Betty
116
Animating Real-Time Game Characters
FIGURE
3.35
The
thumb
is a
little different
from
the
fingers,
but you
assign
the
vertices
in
the same way.
Hand link (Link D) can share influence with Betty R FingerO (Link C). Un-
hide all the Biped Finger objects of the right hand to test the weighting.
Saving Your Weighting Values
Most of the time, the best way to save your weighting values is to save it-

erative versions of your mesh as you work. You can also easily reuse or
recover your weighting by saving the .phy file. Do this by clicking on the
Save Physique (*.phy) File icon (Figure 3.36).
FIGURE3.36 Save your Physique file
for additional insurance or later
reference.
Chapter 3 Weighting a Character Using Manual Vertex Assignment
117
Keep in mind that when re-loading a physique file into one character
or another, the Biped structure has to be the same, with the same added
bones (if any) assigned to it.
When working with older Biped or 3ds max files, Biped will sometimes revert to the
previous version of character studio's naming convention. This means that all
Biped links will be named after their child (one link below) instead of the actual
bone they correspond to.
Assigning the Neck, Shoulders, and Torso
Hide m_headarmleg, and unhide m_torso, m_energy, m_fanvent, and all
the Biped Spine objects, and go to the Right viewport (Figure 3.37).
FIGURE 3.37 Even torso mesh objects are supposed to be heavily armored (that is, rigid).
Start with the neck. Since the head is a separate object, it's easier to
weight both it and the neck. When the neck is joined to the head, it re-
quires more polygons and more time to set up the weighting. Zoom in
to the top of the neck, select the vertices there, and assign them to the
Betty Head link. Unhide the Biped head and m_headarmleg to test
the deformation (Figure 3.38).
118 Animating Real-Time Game Characters
FIGURE
3.38
The top of the
neck

is
linked
solely
to the
head
to
avoid making
the gap
there
visible.
Since there's no geometry at the top of the neck, the line of vertices
there has to move with the head. Now, undo any rotations you did, and
re-hide m_headarmleg and Betty Head. Hide the assigned neck vertices,
go to the Front viewport, and select all the vertices near her right shoul-
der geometry. Don't include any of the rear backpack geometry (for ex-
ample, m_fanvent or m_energy), but assign them instead to the Betty R
Clavicle link (Figure 3.39).
Linking the shoulder to the clavicle gives you a small amount of mo-
bility, but because Betty is supposed to be wearing heavy armor, the
shoulder will remain almost motionless throughout her animations. Hide
those assigned vertices, and go back to the Right viewport. Make sure all
three of the mesh objects are selected (m_energy, m_fanvent, and
m_torso), and assign the vertices of the backpack and upper torso to the
Betty Spine2 link (Figure 3.40).
All the vertices are assigned to the second spine link instead of par-
tially to the third, because the backpack and upper body armor need to
appear hard and inflexible. Assigning as many vertices as possible to one
link achieves this look. However, because there are four links, some of
the lower backpack and torso vertices can be assigned to Spinel, the par-
ent of Spine2 (Figure 3.41).

Chapter 3 Weighting a Character Using Manual Vertex Assignment 119
\ II I
FIGURE
3.39 Assign
the
shoulder
pad
vertices
(1) to the
Betty
R
Clavicle
link
(A).
FIGURE
3.40
The
backpack
and
upper
torso vertices
(2) are
assigned
to the
Spine2 link (B).
120
Animating Real-Time Game Characters
FIGURE
3.41
The

vertices
in
vertex Group
3 are
assigned
to
Link
C, the
Spinel link.
Earlier, Spine2 was chosen as a link for the backpack vertices, because Spinel
would have vertices assigned to it as well, and Spine2 was a better choice over
Spine3 due to its proximity to the next bone in the hierarchy.
Next, the vertices near the waist need to be tweaked further, to make
sure they deform smoothly when the torso bends and twists. Select only
the vertices that make up the two rows you just assigned to Spinel, bring
up your Type-In Weights menu, and assign the vertices to the Betty
Spine link as well. Make sure you don't assign any backpack vertices to
the second link (Figure 3.42).
Weighting the Other Leg
Assign the vertices of the right leg to their proper link by referencing the
first leg you spent time weighting. First, assign the Toe vertices of the
leg element of m_torso to the Toe link, and hide them. Then unhide
m_headarmleg, and go to the Front viewport. Select both m_torso and
m_headarmleg. Click on the Select by Link button on the Vertex menu to
the right (Figure 3.43).
Click
on the
left
Foot link
and

study
the
vertices selected (Figure 3.44,
page 122).
Chapter 3 Weighting a Character Using Manual Vertex Assignment 121
FIGURE
3.42 Giving
the
waist
vertices influence from
both
Spine!
and
Spine
ensures
smooth deformation.
FIGURE 3.43
The
Select
by
Link button
selects
all
vertices
assigned
to a
link.
Using Select by Link is a quick way to see which vertices you previ-
ously assigned and how. Because of the pose of the Biped rig, some of the
vertices of the right foot geometry are included in the vertices assigned to

the left Foot link. Ignoring this temporary weighting, select all the ver-
tices of the right foot geometry that mirror the left foot geometry. Assign
them to the Betty R Foot link; then, using the left foot vertices as a guide,
type in matching values for the right foot vertices (Figure 3.45).
122 Animating Real-Time Game Characters
FIGURE
3.44
Selecting
the
left Foot
link
to see
which
vertices
are
assigned
to it
also
selects
some vertices of the right foot geometry.
FIGURE
3.45 Using
the
vertices
of one
foot
for
reference,
the
other

one is
easily
and
quickly
weighted.
Chapter 3 Weighting a Character Using Manual Vertex Assignment
123
Use this same technique to weight the right knee and rest of the right
leg geometry. When you get up to the thigh area, hide m_headarmleg,
and make sure to assign the left thigh vertices to the Betty L Thigh link
(Figure 3.46).
FIGURE
3.46
Don't
forget
to
assign
the
left
thigh
vertices
to the L
Thigh
link.
Loading a .Bip File into Biped
Before moving on to weight the hips, you need to apply a run animation
to the character to see the effects of the weighting as you make adjust-
ments. The rest of the character could have benefited from a full anima-
tion as well, but for the hips, it's especially important to see the
character's mesh deform while adjusting it. A run or walk animation is

perfect for this.
Hide everything but Betty Spine and m_torso. Select Betty Spine, and
go over to the Biped menu on the Motion panel. Make sure you're out of
Figure mode. Click on the
the character will stay in view, even if the animation translates it through
space and it's supposed to move off-screen. This mode is great for fine-
tuning animations for real-time characters, which, by nature, usually
need to be animated "in place" for implementation in a game.
Click on the Load File icon (Figure 3.47).
In Place Mode icon (it turns purple). Now
124
Animating Real-Time Game Characters
FIGURE3.47 Click on the yellow Open
File icon to load a .bip animation into
your character.
Find Run.bip in the Chapter3 directory on this book's CD-ROM, and
load it into your character's Biped. Click on the Time Configuration icon
located near the bottom of the screen to the right (Figure 3.48).
FIGURE
3.48
The
Time Configuration icon
brings
up the
menu that controls the number of frames displayed.
Once the Time Configuration menu comes up, establish the number
of frames in the active animation range by setting the Start Time to 0 and
End Time to 18 (Figure 3.49).
Changing the length of the animation to match Run.bip allows you
to play it in an endless loop if you want. Hit OK, and as you slide the

Time Slider or advance through the animation frames, the mesh deforms
with the run animation.
Advance forward through the animation one frame at a time by hitting the period
(.) key. Go back a frame at a time by hitting the comma (,) key. Play and stop the
animation by hitting the slash (/) key.
Chapter 3 Weighting a Character Using Manual Vertex Assignment 125
FIGURE
3.49
Set the
animation
Start
and End
time
to 19
frames (0-18).
With the animation applied to the Biped, you will find it easier to see
the deformation on all parts of the mesh. With the In Place mode active,
the character won't run away as you try to weight it.
The In Place Mode icon has a fly-out menu that allows you to restrict the movement
along the X-axis only, Y-axis only, or both simultaneously (the default). Just hold
down the mouse button with the cursor over the icon, and drag down to bring up
the other options (Figure 3.50).
Tackling the Hips
The hips are one of the most difficult areas to weight, second only to the
shoulders. Usually, even when weighting vertices manually, it's a good
idea to see how closely the default initialization weighted the hips before
dialing them in by hand. Put Betty in her Initial Skeletal Pose, and select
all the vertices around her hips. Click the Remove from Link button to
make it active, go to the Front viewport, and drag your selection fence
across all the links on either arm.

126 Animating Real-Time Game Characters
FIGURE
3.50 These
are the
options
for
the In Place Mode icon's fly-out menu.
Whenever you use Remove from Link, you must select the right type of three avail-
able vertices. Since you 're dealing solely with rigid vertices, make the green plus
sign active, or the removal won't take. Also, under the Blending Between Links
menu, choose No Blending (Figure 3.51).
FIGURE
3.51 Under Vertex Type, select
the
color of the vertices to which you're
applying Remove from Link.
Drag the selection fence across the upper body Spine links, as well.
Lock the vertices, and play or frame forward through the animation. The
front part of the hips look good, and the posterior looks nice except for
the bottom two rows of vertices of her rear. When Betty takes a step, you
can see those vertices have too much weight assigned to the leg links, so
they need to be corrected.
Turn on the Initial Skeletal Pose again, and, on Betty's right buttock,
select the nine vertices shown in Figure 3.52. Unlock them, and assign
them a weight of 1 for both the Betty R Thigh link and the Spine link that
appears just above it in the Type-In Weights dialog box (Figure 3.52).
Chapter 3 Weighting a Character Using Manual Vertex Assignment 127
FIGURE
3.52 Assign these vertices
an

equal
weighting
value
for
both
the
Thigh link
and
Spine link above it.
If you had not checked Triangle Pelvis under the Structure sub-menu on the Biped
rig, you wouldn 't have the two additional Spine links to help hold the hips together
(Figure 3.53). As you'll see later, these two Spine links will often supplant the
Pelvis link—if not replace it entirely—to hold the hip shape together.
FIGURE
3.53
The
Triangle
Pelvis
checkbox
is
pretty useful after all.
Turn off Initial Skeletal Pose again, and see how the area deforms.
Everything should look good now, except for the three vertices above the
ones just corrected. Select these three, unlock them, and assign them to
the Spine link above the Thigh link (Figure 3.54).
128
Animating Real-Time Game Characters
FIGURE
3.54
These

three
vertices
still
need
a bit of an
adjustment
to
their weighting.
After you've assigned them to the Spine link, give the vertices a
shared value of 0.5 with the Betty R Thigh link. Turn Initial Skeletal Pose
off once again, and check how the right buttock deforms from all views as
she runs. Do the left buttock as well, using the right as a guide. They
should look fine—the hips are done.
Adjusting the Gun Arm
Hide everything, and then unhide the m_gunarm mesh object. Go to the
Right viewport. From the looks of it, this object needs a little help (Figure
3.55)!
Select the object, go to the Vertex Sub-Object menu under Physique,
and put the object in its Initial Skeletal Pose. Select all of the vertices that
make up the left forearm elements of the mesh: hand, gun body, and
even the cylinder that covers her elbow. Rotate your view as necessary.
If you have Initial Skeletal Pose checked, and you then select another object in your
scene, and go to the Physique root or even to another Physique sub-object, the mesh
will remain in its Initial Skeletal Pose.
Don't select any of the vertices belonging to her upper arm element,
and only select the first few vertices of the belt that feeds into her back-
Chapter 3 Weighting a Character Using Manual Vertex Assignment 129
FIGURE
3.55 What
is it?

pack. Assign all these vertices to the Betty L Forearm link, and turn the
Initial Skeletal Pose back off to see the results (Figure 3.56).
FIGURE 3.56
With the vertices assigned to the L Forearm link, the arm looks much better.
130
Animating Real-Time Game Characters
FIGURE
3.57
The
belt
feed
geometry
has to be
linked
to
both
rear
shoulder
and
forearm.
The solution to this weighting dilemma isn't adding extra bones, it's
carefully sharing the weighting between Betty L Forearm and Betty L
Spine2—bypassing Betty L UpperArm altogether. Rotate your view so
you're looking down on her left side, and advance to Frame 6 in the ani-
Hide the vertices assigned; select and assign the upper arm element
vertices to the Betty L UpperArm link. Once they're assigned, hide them
as well, and you can then begin work on the real problem area: the belt
feed.
The shoulder for the left arm is a different design from the right one and can move
around with the arm. The only time it will look a bit odd is when Betty's arm goes

very far up or very far back.
The belt feed geometry is a looping structure that goes from back-
pack to forearm. Unfortunately, an extra set of bones couldn't be linked
to the Biped to serve as a weighting link for the geometry. If the bones
were linked to the back or shoulder, they wouldn't move with the arm.
If they were linked to the arm, they wouldn't stay linked to the back
(Figure 3.57).
Chapter 3 Weighting a Character Using Manual Vertex Assignment
131
mation. Select all the remaining vertices of the object and assign them to
Betty Spine2 (Figure 3.58).
FIGURE
3.58
Assign
the
remaining belt feed vertices
to
Betty
Spine2.
Keeping selected all but the four vertices that touch the backpack,
bring up the Type-In Weights menu, and assign those vertices an addi-
tional weighting value of 0.5 to the Betty L Forearm link (Figure 3.59).
Deselect vertices from a selection set by dragging your selection fence across the ver-
tices while holding down the Alt key.
Obviously, the geometry can't stay that way, but at least the two
links to which the vertices need to be assigned are now ready to be dialed
in and their respective influences adjusted. Put the mesh back into its Ini-
tial Skeletal Pose, and begin at the row of vertices that starts at the top of
the feed belt near the shoulder. Rotate your view so you're looking at
the row of vertices "edge-on," and change their value from 0.5 to .05

(Figure 3.60).
Work your way over and down to each row of vertices until you
have the values for them shown in Figure 3.61.
Note how the forearm is given progressive influence over the feed
belt. This will result in a smoother deformation of the geometry. Now,
132 Animating Real-Time Game Characters
FIGURE
3.59 Being equally influenced
by
both
the
Spine2 link
and the
Forearm link
is a
start.
FIGURE
3.60 Rotate
your
view
so you can
clearly
see the row of
vertices
to be
adjusted.

×