Skeleton

The next task is to bind Harry to a skeleton. The example project for starting this chapter is 'tutorprojects/harry/body_hair_skin.r3d'.

Take a side view. Set view projection to Parallel (hotkey '*' toggles the projection), because it is easier to position the skeleton without the perspective distortion. Zoom the view so that the body fills it. Placing skeletons inside shaded surfaces is often easier in wireframe mode. If your view window is still in Shaded OpenGL mode, select View Properties from the popup menu, go to Draw tab, clear the Shaded option and close the View Property Window.

Switch the tool bar to the Modifier tab. Activate the Skeleton tool. We will draw the backbone first. Because the body shape is so simple, one bone will be enough to control the body. So, LMB click first in the hip, move the mouse upwards. Swing the mouse sideways (approximately 45 degrees to both directions) to define a typical motion range of the backbone. At the start of the backbone, there is a triangular joint constraint, which shows how much the bone can rotate around its root. The triangle should point upwards. If not, move the pointer straight up from the hip and Ctrl-Click to set the constraint direction. Click second time at the top of the head to define the end point of the backbone. Then click Accept or hit Enter to finish the tool. Rename the created object as backbone.

Backbone added

Next we will draw a skeleton for legs. Motions of bones are constrained by a set of angles. You can define the most important angle constraints intuitively already when drawing the skeleton. Therefore, it is best to draw the skeleton in a plane where it bends most. Clearly, a side view is the best view for defining how the knee bends.

Activate the skeleton tool and click first in the hip. Leg will connect there to the backbone. Then move the mouse down towards the knee. Try to avoid accidental mouse movements upwards from the hip because mouse motions now define the main angle constraint for the joint. Harry is a fat character and his legs cannot bend that high.

We can set now the orientation for the hip constraints of the leg. The constraint space should point towards the center of the motion range of the thighbone. For a leg, that direction is straight down. This is quite important: if the constraint space points upwards, key framing leg's motion from back to front would rotate the leg up through the body.

You can see the direction of the first constraint from the triangle at the start of the skeleton. If you moved the mouse down from the hip, the triangle can already point to the right direction. If not, press Ctrl down and LMB click in the middle of the knee. Ctrl-click does not add new joint but sets the constraint orientation.

Move the mouse forward and up until the thighbone is rotated to its extreme front position. Then rotate the bone back to the knee position and then backwards to its extreme back position. This way you can 'teach' to the bone how much it can move.

Ctrl click at the knee sets root constraint direction downwards

Click in the middle of the knee to add a new joint. Then carefully move the mouse down to the angle point. Define the angle limits again by moving the mouse backwards and up, until the shinbone is rotated to its extreme position. Do not rotate the bone forward, because the knee does not bend that way. Click in the ankle to finish the shinbone.

Defining angle limits for a bone
[Note] Note
If you accidentally define a wrong joint position, just select Go Back from the popup menu or hit Backspace. You do not have to start from the beginning. Note also that angle limits can be adjusted later easily. It is enough to draw the skeleton approximately the right way. You can fix and fine tune everything later.

After the ankle joint, add one joint to the position where toes bend. Put the last joint to the tip of the toes. Click Accept to finish the leg skeleton. Rename the skeleton object as leg1.

Switch to the front view. Make sure that the backbone is in the middle of the body. Move it, if necessary. Select the leg skeleton. Use the blue object space handle to move the skeleton to the middle of the left leg.

The skeleton for legs finished

Hit the spacebar key to set the skeleton in edit mode. Click the little red knob at the hip joint to select the first joint of the leg. You will see some handles, which control constraint angles. Drag the little black triangle at the end of the green line to the left, until the angle sector appears suitable for thighbone's motion range to that direction. Then drag the triangle at the opposite end of the sector to the right.

[Note] Note
The cursor changes into a pen shape when the mouse pointer is close enough for dragging a constraint handle.
Adjusting angle constraints for leg motion sideways

There is a third motion sector to define left: rotation of the thighbone around its axis. Take a top view. You can see the sector as a blue line. It can be adjusted just like the green sector above, but let's use numeric controls for a change. Open the property window, go to the Spec tab, and Joints/Constraints sub tab. Decrease the Banking/Min angle to, say, -15 degrees, and Max angle to 15 degrees. Note how the sector changes respectively on the view window. Close the property window.

Now the first leg skeleton is ready. Hit spacebar to turn the edit mode off. Switch back to the front view. Press Ctrl down and move a duplicate of the leg skeleton using the blue move handle to the middle of the other leg. Rename the copy as 'leg2'. Turn the edit mode on and adjust the green motion sector of the thighbone (it should be mirrored from the other leg).

Adjusting banking constraints from the property window

Legs are now ready. We need to add two skeletons more for the horns. We can assume that horns are quite flexible and bend to all directions symmetrically. So, we can draw the skeleton from the front view. Pan and zoom the view to see the left horn properly. Start the skeleton tool and draw the skeleton inside the horn the same way as you defined the leg skeleton. Remember to set the root constraint after the first point with a Ctrl-click, and swing the mouse slightly sideways to set symmetric angle constraints for each joint. For flexible bending, add as many skeleton joints as there are cross sections in the SDS control cage. When the bone and geometry density match, the result behaves elastically. You can end the skeleton anywhere after the bendable area. It does not have to reach longer than controlled geometry points. Rename the new skeleton as horn1.

The skeleton for the left horn

We need to allow some bending of horns in front-back direction as well. Set the horn1 skeleton to the edit mode. Click the first joint (the one close to the head) to select it. Open the property window and go to the Spec/Joints/Constraints tab. Enter the Pitching range Min=-30, Max=30 degrees. You can finetune the Heading limits to the same range if you like. Banking range can remain zero because horn shape does not need it. Activate the joints one by one and set same kind of angle constraints for them all. Then you can close the property window.

Duplicate the horn1 skeleton, move and rotate it inside the second horn geometry. Rename the copy as horn2. Take a side view and make sure that the horn skeletons are inside the respective geometry.

Multi select the leg and horn skeletons and drag them into the backbone hierarchy. Multi select all the sub skeletons, and hit the Attach button on the toolbar to connect the sub skeletons to the backbone. The Attach option means that pulling any bone with Inversed Kinematic tool will eventually drag the full skeleton along (unless so called anchors have been set). Select the backbone and click the Store button on the toolbar. This records the current state of the skeleton (including the sub skeletons) to be the native pose of the system. You can any time return to the stored pose by clicking the Native button. Finally, drag and drop the backbone object into the hierarchy of the Harry character.

The next step is to bind the points of the model to the skeleton. The project template for practicing the binding tools is 'tutorprojects/harry/skeleton.r3d'.

Select the backbone and hit the Bind Nrst (Bind Nearest) button in the toolbar. This operation, which binds all objects in the same hierarchy level, is a simple way to get started, although the result most likely needs some corrections.

Make sure backbone is still selected and hit the spacebar to put the skeleton system into the edit mode. To test the result of the Bind Nearest action, drag the skeletons for example from the end of a toe bone to change the pose. Most likely you will see some strange deformations in the geometry of the character, because of some wrong skeleton bindings. Hit the Native pose button in the toolbar to reset the skeleton.

Apparently eyes and horns were mapped correctly - the respective skeletons are clearly the closest. Hair should be bound only to the backbone, but part of it got bound to horns. The simplest way to fix this is to unbind the hair completely and then make a new binding. So, multi select the hair level and the skeleton system's root object (=backbone) and hit the Unbind button in the tool control bar.

Hair no longer follows the skeleton. We can also clean up the model at this point. Open the hair level, then the interpolator object under it and select the first hair curve. The bold typeface on the select window indicates that the hair curves still have animation data attached (the root choreographs, under which the skeleton binding choreographs were placed). Make sure that the first curve is not in point edit mode and hit Ctrl-a to multi select all hair curves. Then select Delete Choreographs from the select window's popup menu.

The skeleton we created will not be used to deform the hair - it is far too inaccurate for that purpose. Thereore, we can use a simpler and quicker way to attach the hair to the backbone. Instead of mapping the thousands of points one by one to the backbone, we will use a special Carriage constructor object to attach the hair object as a single target.

Close the hierarchy of the hair level and leave the level selected. Go to the Modifier tab of the toolbar and activate the Carriage tool. Click in the middle of the backbone, move the mouse and click a second time. The two clicks define a coordinate system, which will control the hair. The orientation of the coordinate system does not matter, because all its points will be attached to the backbone. When the tool is finished, a new item 'Carriage' appears to the select window. Drag and drop it to the hierarchy of the harry level, and rename it as 'hair_carriage' to describe its purpose better.

Put the new carriage object into the edit mode (hit spacebar) and select all its points by dragging a box around the coordinate system geometry. Next select the backbone object. It should still be in the edit mode. In the view window, click the bone inside Harry's head (= the real backbone) to select it. Remember: the selection is indicated by a highlighted bone axis and the constraint handles.

Then shift click the carriage object on the select window, to multi select both objects. Click the Bind button of the skeleton tool group on the tool control bar (note: use the Skeleton Bind, not the Carriage Bind tool). The geometry of the Carriage object became bound to the backbone.

The next goal is to fix the incorrect bindings of the body mesh. Multi select the hair level and the carriage object and hit 'i' hotkey to make the dense distracting wireframe invisible. Select the body level and hit spacebar to turn the edit mode on. If you do not see the point handles, open the level, select the actual SDS body under it and change its edit mode to Edit/Points from the tool control bar. Then close the level containing the body and leave it selected, edit state on. Make sure that all points are unselected - hit Ctrl + t to unselect all points, if necessary.

Select the backbone skeleton object. Drag select all bones on the left horn. Then press Shift key down and add all bones of the right horn into the selection by a new drag selection box. Shift click the Body level on the select window to multi-select it, too. Then hit the Select button on the tool control bar. All points mapped to the horns became selected.

Applying the Select tool to find out which points were mapped to the horn skeletons

Click the body level on the select window to remove the skeleton system from the selection. Then deselect all points of the horns of the body, for example by Alt-dragging two selection boxes around them. The remaining selected points are exactly the points, which were incorrectly mapped to horn bones instead of the backbone.

Press Shift key down and add click the Backbone object on the select window to multi select it with the body. The skeleton still has the horn bones selected after the previous steps of this tutorial. Click the Unbind tool to remove the incorrect binding.

Incorrectly mapped points extracted

Carefully change the object selection to the skeleton only by clicking it on the select window. You should not lose the valuable point selection of the body mesh by an accidental click or drag on the view! When the skeleton system alone is selected, go to teh view window and click the backbone inside the body to select it. Then Shift click the body level on the select window to multi select it. Finally, hit the Bind button on the tool control bar to make a new, right kind of binding.

There are some more incorrect bindings at the leg-backbone joint area, but you can fix them exactly the same way as instructed above. Just select all leg bones, apply the Select tool to find out which points are mapped to them, exclude the correctly mapped points, unbind the remaining points from the leg bones and bind them to the backbone.

Save the project as 'harry_rigged.r3d'.