Tuesday, February 2, 2010

BGE 2.49 Character Creation

Discuss this video at Ira Krakow's Blender 3D Forum!



Creating a character for Blender's Game Engine is different from creating a character in Blender 3D. In Blender 3D, you have a wider range of options for creating detailed characters, such as adding geometry for details, using curves and surfaces, and sculpt mode. These high-polygon models work well for rendering. However, if such a model is placed in the Game Engine, the animation would slow down to an unacceptable level. Some commonly used techniques, such as subsurf, are not available in the BGE. BGE characters should be low-polygon for best performance.

However, they can't be too low-poly, because the characters will look too much like rectangles and squares. In addition, you need enough geometry to do realistic animations in the BGE, such as walk cycles and lattice deformations. So creating a character for the Blender Game Engine is a tradeoff. In this tutorial, which is based on Tony Mullen's discussion in Mastering Blender, a book I recommend if you want a great introduction to Blender in more depth, I show a recipe for creating a character for the BGE. It's more a set of steps than a fully realized character. I leave that to you. I encourage you to use these steps to create your own character and post your result on my Blender 3D Forum at http://forum.irakrakow.com. I used Blender 2.49b.

So let's get started. Start with the default Blender scene. Go into Front View (Num1), the best view for the BGE because it shows the effect of gravity. Make sure you are in Edit mode, with all vertices selected. Press the W key to bring up the Specials Menu. Select Subdivide Smooth, accepting the default of 1.00 by clicking OK. The result is a polygon with 24 faces.

Press the Z key to go into wireframe mode. Deselect the 3D Transform Widget, which gets in the way of this demo. Press the A key to deselect all vertices. Position the cursor in the lower right area of the polygon, and press the B key to box select. Box select the lower right vertices. Press the E key, and select Region, to extrude the region of vertices. Scale the extruded vertices by pressing the S key, and then the Z key, and then the number 0. Finally, with the vertices still selected, press the E key again and extrude the vertices downward to complete the leg.

We're going to model the rest of our character with the Mirror Modifier. To do that, press the A key to deselect the vertices. Box select (B key) the vertices on the left side of the model. Press the X key to delete, and select Vertices. Now we have half the model. We're going to mirror the model along the X axis. Go to the Editing Buttons (F9). From the Modifiers tab, click the Add Modifer button. Select Mirror. You should see a mirror of the right side of the model on the left side. Make sure that the X button and the Do Clipping button are enabled, and that the Merge Limit is 0.001.

Now we're going to do the shoulders and arms. Box select the upper right vertices. Press the E key to extrude the forearm. You can use the S key to scale the forearm either more or less. Press the E key again to extrude another part of the arm, and use the S key to scale it down. Press the R key to rotate a bit as well. Extrude one more time by pressing the E key. Note that the left arm is being created as well, a mirror of the right arm.

Let's bend the knees a bit. Go to side view (Num3). Box select (B key) the knee vertices (the ones in the lower middle of the leg), and move them a bit on the Y axis by pressing the G key, then the Y key, then moving the vertices, then pressing Enter.

Let's add a head. Go to Front View (Num1). Press Alt-A to deselect the vertices. Box select (B key) the upper right vertices. Press the E key, selecting Region, to extrude the head upwards.

The shape of the character is done. We don't need the Mirror Modifier any more. To apply the Mirror Modifier to the model, press Tab to go into Object Mode. Then press the Apply button to add the geometry on the left side to the mesh on the right side. Pressing Tab to go into Edit mode shows that we have a complete character. We need a bit more geometry to make this character work well in the BGE. To do that, press the A key to select all vertices. Then press the W key for the Specials menu. Select Subdivide Smooth. Our character has a few hundred faces, enough for moving around in the BGE but not so complex as will slow down the BGE.

We're going to paint our character using Texture Paint. To do that, we first need to mark a seam for unwrapping. Go to Front View (Num1). Position the cursor at the center of the character, at the border of the left and right part, and press Alt-Right click to select the edge loop. Press Ctrl-E to bring up the Edge Specials menu, and select Mark Seam. Split the 3D window to create a UV / Image Editor in the right part of the window. Press the A key to select all vertices. Then press the U key, selecting Unwrap, to unwrap the mesh. In the UV / Image Editor, select Image, then New. The default size is fine. We want to click on the UV Test Grid as well. Then press OK.

Change the view to Textured. At this point, we can change the mode to Texture Paint and actually paint our character. We can play with the brush, opacity, size, blend, and other settings by changing the options in the Paint panel.

At this point, we have a modeled and textured character. Save your Blend file because we will use it in the next video, to rig our character and have it fully participate in the game. Just to prove that our character works in the Blender Game Engine, go to the Logic Buttons (F4). Change the Physics type of our character to Rigid Body (Dynamic would work as well). With the cursor in the 3D window, press the P key. Our character falls int the abyss, pulled by the Bullet Physics calculations. Congratulations, we have made a character for use in the Blender Game Engine. Show off your character at http://forum.irakrakow.com. Subscribe to my Youtube videos. See you next time. Happy Blendering!