Search form

'Building Interactive Worlds in 3D': Building a Skeleton with Inverse Kinematics

VFXWorld presents a new excerpt from Building Interactive Worlds in 3D by Jean-Marc Gauthier. This month, from the Basic 3D Kit, we present a tutorial on how to bring your creation to life.

All images from Building Interactive Worlds in 3D: Virtual Sets and Pre-Visualization for Games, Film & the Web by Jean-Marc Gauthier. Reprinted with permission.

All images from Building Interactive Worlds in 3D: Virtual Sets and Pre-Visualization for Games, Film & the Web by Jean-Marc Gauthier. Reprinted with permission.

This is the next in a series of excerpts from Building Interactive Worlds in 3D by Jean-Marc Gauthier. For the next few months, we will be present chapters from a section entitled The Basic 3D Kit.

It is time to bring your champion to life.

First, you will build an internal skeletal system that will control the body.

Select the Animation module on the right of the Status Line. Go to the Main Menu, select Skeleton > Joint Tool. Start drawing in the front view the spinal skeleton starting from the characters pelvis. To create bones, click once to create the first joint, then move your mouse to the location of the second joint and click a second time. A joint is created at every click. You can create five bones from the spine to the tip of the head. Repeat the same for the right arm starting with the collar joint. Repeat the same for the right leg starting in the hip area. You can adjust the joints by clicking on them and moving them to the right location.

To Connect the Bones for the Spine and for the Leg

First click on the hip joint then on the pelvic joint with the Shift key pressed. Go to the top menu, and select Skeleton > Connect Joint. Repeat the same to connect the arm-first-collar joint and the third spinal joint.

You can mirror the right arm joints to create the left arm joints.

To Mirror Joints

Click on the collar joint, and then select Skeleton > Mirror Joint. Choose Mirror across YZ plane. Repeat the same operation for the right leg, starting with the hip joint.

After creating a full skeleton, go to Window > Outliner. Click inside the Outliner dialog window to view the nodes. Click on the first node to rename it skeleton. Open the names for each chain of joints by clicking on the icons with plus signs next to the names of the nodes and rename them accordingly.

The Next Step is to Bind the Surfaces with the New Skeleton

Select all surfaces for the eye and the body, and also select the skeleton. Go to the top menu and select Choose Skin > Bind Skin > Smooth Bind.

To test the binding process, select one of the joints and rotate it. The mesh should be stretched around the joint. In the following illustration, the shoulder area is stretched around the shoulder joint.

Lets Adjust Weight Maps with the Paint Skin Weight Tool:

Go to the top menu and select Skin > Edit Smooth Skin. Check the box on the right of the menu item. Go to the dialog box with parameters for the joint, and click on different joints to see their respective influence on the skin of the character. Keep working only on the right half or the left half of the 3D model.

The color of the skin can change from white to black, according to the intensity of the skin weight around the joint. Painting around the joint with a brighter color increases the value of the attraction of the joint on the mesh. Painting a brighter skin weight increases the force of attraction of the joint on the mesh. Parts of the mesh around the joint move easily in places with a stronger force of attraction. Parts of the mesh located further away from the joint move with more resistance.

You can control the intensity of the attraction by changing the Min/Max Value from -1 to 1 and by turning on the Add button to paint over the skin.

Surfaces of body parts are not all affected by the motion of a joint. A skin weight with a dark color keeps meshes idle when a joint is moving.

For example, when you select the left collar joint, the skin weight for the head is black. This explains why the head will remain idle when you move the left collar joint. Select various joints in the Outliner and rotate them to test your model.

Setting up the locator for the body.

Setting up the locator for the body.

To Mirror the Skin Weights to the Opposite Side

Move your model in the middle of the Y axis. Go to the top menu.

First, select Skin > Bind Pose. Second, select Skin > Edit Smooth Skin > Mirror Skin Weights. Specify the right direction and a plane. If you work on the right side of the character, select Direction Positive to Negative.

In the workspace, run some tests by moving the joints with weight maps on the left and right sides. They should be identical.

Lets Look at Applying Inverse Kinematics to Your Skeleton

Inverse Kinematics (IK) is an animation technique inspired from string puppets in which a chain of articulations follows the animation of a single string attached to the end of the chain.

A string, attached to the hand of a puppet, can connect a chain or joints including the lower arm, elbow, upper arm and shoulder. Although only the last joint of the chain, the hand, is animated, the chain of joints follows the animation naturally. The IK technique allows you to animate only one joint located at the end of the chain of joints, instead of each joint of a skeleton.

You can use IK for animations controlled by realtime events. For example, one joint located in the palm of the hand can react to sounds produced by the viewer and move the arm in a realistic way.

To setup IK, go to the top menu, and select Skeleton > IK Handle.

First, click on the left shoulder joint. Second, click on the left wrist joint. Repeat the same operation for the right arm.

To set up IK for the legs, first, click on the left hip joint. Second, click on the ankle joint. Repeat the same for the right leg.

Locators can help you add constraints to the IK handles when joints are difficult to select and move around.

To Create Locators

Go to the top menu, select Create > Locators. Create five locators. Place four of them at the wrists and ankles. Place one locator for the body, in front of the model.

Lets Constrain the Locators to the IK Handles

First, select the locator. Second, select the IK handle.

Go to Constraint > Point. Select the box on the right side of the word. Select the following parameters in the Point Constraint Options dialog window: Weight = 1, Add Targets ON. Select Apply.

Repeat the same steps for the locator in front of the body. Select the following parameters: Offset, Z = -3. Select Apply.

Before exporting the model to Virtools, you needto reorganize the hierarchy of the nodes.

In the Outliner dialog box, select all of the locators and group them by pressing the Control + G keys. Rename the group Locators.

In the Outliner dialog box, drag the locators called Left Arm and Right Arm on top of the locator called Body.

Find more turnkey tutorials that detail all the steps required to build simulations and interactions in Building Interactive Worlds in 3D: Virtual Sets and Pre-Visualization for Games, Film & the Web by Jean-Marc Gauthier: Focal Press, 2005. 422 pages with illustrations. ISBN 0-240-80622-0 ($49.95). Check back to VFXWorld frequently to read new excerpts.

Jean-Marc Gauthier teaches at New York University in the graduate studies department of Interactive Telecommunications and is the author of Interactive 3D Actors and Their Worlds (Morgan Kaufmann Publishers 2000). He is also a consultant at www.tinkering.net and an award-winning 3D artist.

randomness