Creating Reusable Characters With Blender and Unity
Characters in video games are often as memorable as the accompanying gameplay and music. In this tutorial, you’ll learn how to prepare a humanoid model using Blender and how to bring it into Unity. By Eric Van de Kerckhove.
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Contents
Creating Reusable Characters With Blender and Unity
40 mins
Torso
On to the head! Select the connector at the top of the Chest bone, press E, Z, .055 and Enter consecutively. This is the neck bone so name it Neck in the Bone Properties tab.
To add the head bone, keep the top connector selected and press E, Z, .95 and Enter in that order.
Name the newly created bone Head.
Next is the left shoulder connector. Select the top connector of the Chest bone and press E, X, .08 and Enter to add the new bone. Move it down a bit by selecting the rightmost connector and pressing G, Z, -.09 and Enter.
Name this bone ShoulderConnector.L. This bone will connect the chest to the shoulder. None of this is anatomically correct in any way, and it doesn’t need to be. :]
Next up is the arm itself! Select the rightmost connector of ShoulderConnector.L and press E, X, .85 and Enter in that order. This creates one large bone that needs to be split up to create the remaining bones for the left side.
Select the newly made arm bone, right-click and choose Subdivide in the context menu. Change the number of cuts in the bottom left to 3, so you get four pieces in total.
Name these bones as follows, from left to right:
- Shoulder.L
- UpperArm.L
- LowerArm.L
- Hand.L
The way these bones are laid out might look good at first glance, but because the way the connector between the arm pieces sits (also known as an elbow), the arm won’t be able to bend correctly. Hold Z to open the shading menu and drag your cursor to the left to enter the wireframe view.
Now take a look at the bend in the arm:
The red line indicates where the elbow is now and the white line indicates the arm’s bending point on the mesh. To fix this, select LowerArm.L and move it to the right by typing G, X, .09 and Enter.
Now switch back to Solid rendering by holding Z and moving your cursor to the right.
That’s it as far as adding bones goes. How about the right side though? Well, I don’t know about you, but I’ll take any shortcut I can get to get the work done! That’s why the next step is mirroring the bones on the left to the right with a few keystrokes.
Mirroring
Blender has a nifty feature to quickly mirror the bones of an armature in just a few simple steps! To start off, deselect all bones by holding Alt/Option and pressing A. Next, select the bones on the character’s left side (the right side when seen from the front) by holding Shift and clicking the bones one-by-one. Don’t forget about the foot!
With those bones selected, right-click and select Symmetrize in the context menu. This is all you need to do to get a perfect mirrored version of the selected bones:
The bones will also all have .R automatically at the end of their name instead of .L to signify what side of the body they’re used for.
Now save the file and prepare to move on to rigging.
Weight Painting
Weight painting is the process of binding bones to a 3D mesh. Each bone gets attached to a group of vertices with a certain amount of weight.
The weight decides how “hard” the vertices will be pulled and pushed by the bone.
Doing this manually would take a while since you’d have to paint the weight of every single bone. Luckily, Blender can take care of most of the grunt work by automatically weight painting based on how close the bones are to the vertices. This works by parenting the model to its armature and letting Blender automatically assign weights.
Press Tab to switch to Object mode. Click on the character model to select it, then hold Shift and click the armature to select that as well. The order you do this in is important, as the last selected object will be the parent. Now press CTRL + P to open the Parent menu and choose With Automatic Weights to parent the model to the armature and perform automatic weight painting.
On to the cool part! Select the armature, then change to Pose mode with the drop-down at the top left. Now select a bone and rotate it around by pressing R and moving your cursor around. Do this with each bone on the center and the model’s left side to check if everything the bones were weighted correctly.
After checking all of the bones, you may have noticed the eyes don’t move with the head, which looks a bit weird, to say the least!
To attach the eyes to the head, you’ll need to do some actual weight painting. Keep the armature in Pose mode, then hold Shift and click the model to add it to the selection. Now enter Weight Paint mode and prepare to do some painting.
This mode shows both the bones and the weight attached to them on parts of the model.
Start off by deselecting all bones by pressing ALT/Option + A. Next, hold Shift and click on the Head bone to select it. The weight colors go from dark blue, to green and finally red. As you can see, the eyes are dark blue, which means they aren’t attached to the head bone at all! To attach those eyes to the head bone you’ll need to increase their weight.
For easier access to the eyes and to strengthen the effect of adding weight, rotate the head bone backward by pressing R, X, -90 and Enter in that order. It looks grizzly, but don’t worry, he won’t feel a thing!
To attach the eyes to the Head bone, it needs some weight added to it. To start off, select the Add brush in the Brush section of the tool panel at the top left. By default, this is set to Subtract.
Now paint on the eyes to increase the weight until the eyes aren’t floating anymore.
To check out the result, reset the view by pressing numpad 1 and press Alt (or Option) + R to reset the rotation of the Head bone. The eyes are now correctly connected to the head.
With the basic weight painting done, it’s time to add some details.