From BlenderWiki

Jump to: navigation, search

Your First Animation in 30 plus 30 Minutes Part I

This chapter will guide you through the animation of a small “Gingerbread Man” character. We will describe each step completely, but we will assume that you have read the interface chapter, and that you understand the conventions used throughout this book.

In Part I of this tutorial we’ll build a still Gingerbread Man. Then, in Part II, we will make him walk.

Note
For a much more in-depth introduction to Blender that focuses on character animation, check out the Blender Summer of Documentation’s Introduction to Character Animation tutorial.
BSoD-ItCA-demo-02.jpg
BSoD-ItCA-weightPaint-29.jpg
BSoD-ItCA-lower-body-25.jpg

Just like the “Gus the Gingerbread Man” tutorial you see here, the BSoD “Introduction to Character Animation” tutorial assumes no prior knowledge. It guides you through the process of making a walking, talking character from scratch and covers many powerful features of Blender not found here.

The BSoD “Introduction to Character Animation” also has a downloadable PDF version (3.75 MB) for offline viewing.


Warming up

Let’s start Blender. On the default screen you should see a top view of a camera, a light, and a cube. The default cube should already be selected, as indicated by its pink color.

Default Blender start-up screen.

We will organize our working area by placing objects on different Layers where we can hide them. We can bring them back into the current scene whenever we need them. Here is how Layers work:

Layer visibility controls.

Blender provides you with twenty Layers to help organize your work. You can see which Layers are currently visible from the group of twenty buttons in the 3D View window header. You can change the visible Layer with LMB Template-LMB.png and toggle visibility with ⇧ ShiftLMB Template-LMB.png. The last Layer that is turned on becomes the active Layer, the one where all objects that will be created are stored.

So let’s clean up the place.

Layer control toolbox.
  1. Select the camera (triangle in bottom right) and the lamp (circle with dots) with ⇧ ShiftRMB Template-RMB.png.
  2. Press M. A small toolbox will appear right beneath the pointer of your mouse. The toolbox will have the first button checked. That means the selected objects are stored in Layer 1.
  3. Check the right-most button on the top row and then click on OK. This will move your camera and lamp to Layer 10.
  1. Now make sure that only Layer 1 is visible by clicking on left-most button of the top row, because we wouldn’t want to erase the lamp or the camera.
  2. Select everything on that Layer using A
  3. Erase the selection with X (confirm the pop-up dialog by clicking on Erase Selected Object(s)).

This leaves all the room we can wish for to begin our modeling job.

Building the body

The cube in Edit mode.

Change to the front view with 1 NumPad. Because we previously deleted all objects, now we need to add a cube. Do this by pressing Space   »  Add » Mesh » Cube. A cube will appear. Press ⇆ Tab, and it will be in Edit mode with all its vertices selected.

Edit mode is a mode in which you can edit the vertices of the mesh. By default, all vertices are selected for every new object created. Selected vertices are highlighted in yellow, and unselected ones are pink.

Object mode is a mode where vertices cannot be selected or individually edited. The object can be changed only as a whole.

You can press ⇆ Tab to switch between these two modes. The current mode is indicated in the header of the 3D window.

Editing context in Buttons window.

We will call our Gingerbread man “Gus”. Our first task is to build Gus’s body by working on the vertices of our cube. To see the Blender tools that we’ll use for this purpose, press the button showing a square with yellow vertices in the Buttons window header, or press F9, to enable the Editing context.

The Subdivide button.

Now locate the Subdivide button in the Mesh Tools panel and press it once.

The subdivided cube.

This will split each side of the cube in two, creating new vertices and faces.

With your cursor hovering in the 3D window press A to deselect all elements. Vertices will turn pink.

Box Select
Selection controls in the 3D View window header.
On many occasions you may have vertices hidden behind other vertices, as is the case here. Our subdivided cube has 26 vertices, yet you can only see nine because the others are hidden. A normal RMB Template-RMB.png click selects only one of these stacked vertices, whereas a box select selects them all. But beware that by default this is true only for the Wireframe draw mode. In any other mode, Shaded, Solid or Textured, you can only select visible vertices, even with box select. To select vertices that are hidden behind others, uncheck the “limit selection” button (see Selection controls in the 3D View window header).


Exclamation mark.png
You must have the “limit selection” button unselected (Tutorial-unchecked-limit-selection-button.gif) to continue this tutorial. This button is also called “occlude background”, and is not visible when in wireframe mode.

Now press B, the cursor will change to a couple of orthogonal gray lines. Move the cursor above the top left corner of the cube, press and hold LMB Template-LMB.png, then drag the mouse down and to the right so that the gray box encompasses all the leftmost vertices. Now release the LMB Template-LMB.png.

Box-selecting the leftmost vertices.
Deleting selected vertices.

Press X and from the popup menu select Vertices to erase the selected vertices.

Mirror modeling

The empty default Modifiers panel.

To model symmetrical objects we can use the Mirror modifier. It allows us to model only one side of Gus while Blender creates the other in real time. Go to the Editing context (F9), and find the Modifiers panel.

Note that on a small resolution monitor this may be off the screen. Clicking one of the downward pointing arrows in the top left of the other panels minimizes these panels so you can see the panel you desire.

Add Modifier menu.

The panel is pretty empty for the moment. Clicking the Add Modifier button opens a list from which you’ll choose Mirror.

The “cage mode” button.

Not much seems to happen, but that is because the modifiers offer quite a bit of control over what’s displayed and when. In our case we will check the “cage mode” button so we can see the transparent faces in Edit mode.

Choosing the mirror axis.

We choose the axis that will run from the modeled side of our character to the side Blender is completing by checking either the X, Y or Z button. The mirror plane is perpendicular to that axis. In our case it is the X-axis.

Setting the Merge Limit.

The Merge Limit numeric field allows for vertices close enough from the mirror plane to merge with their mirror copy, behaving as if they where one, and effectively welding the mirror part to the original one. The limit can be set from 0.000 to 1.000 BU (Blender Units), and how big it should be depends on the nature and the scale of the current job.

For modeling Gus, a vertex that would be more than 0.1 BU away from the mirror plane would be noticeable but anything closer might not. Our mesh could end up ripped in the middle if vertices that should be on the mirror plane aren’t merged. To avoid inadvertently neglecting a wandering vertex, we should set the Merge Limit to 0.1.

Enabling Do Clipping.

Finally, with the Do Clipping button checked, our mirror becomes a frontier that no vertex can cross. If this were to happen it would cause quite a mess! Also, when Do Clipping is active, every vertex that is on the mirror sticks to it.

As you can see, the Mirror modifier gives us a lot of features to make our lives easier.

Arms and Legs

Let’s create Gus’s arms and legs. Using the sequence you just learned, box select the two top-right-most vertices, which will actually select the other two behind them, for a total of four vertices.

Creating Gus’s arms.

Press E and click on the Region menu entry to extrude them. This will create new movable vertices and faces which you can move with the mouse. For this exercise, move them one and a half squares to the right, then click LMB Template-LMB.png to fix their position. Extrude again with E then move the new vertices another half a square to the right.

Undo & Redo

At this point you might be wondering what would you do if something goes wrong. Blender has two Undo features, one for Edit mode and the other for Object mode.

In Edit mode, press CtrlZ to Undo. Press CtrlZ several times to roll back changes as long as the Undo buffer will allow. Conversely, ⇧ ShiftCtrlZ re-does changes. AltU opens a menu with a list of possible undos so that you can easily find the point you want to revert to — it’s the history.

Two things to remember:

  • Undo in Edit mode works only for the object currently in that mode.
  • Undo data is not lost when you switch out of Edit mode, as long as you don’t start editing another object.

In Object mode, the same shortcuts apply. CtrlZ to undo, ⇧ ShiftCtrlZ to redo and AltU to see the history. If you made changes in Edit mode that are not lost for that object, they will all be undone in one single shot with CtrlZ when this step — marked as Editmode in the Object mode’s history (AltU) — has its turn.

If you change your mind in the middle of an action, you can cancel it immediately and revert to the previous state by pressing Esc or RMB Template-RMB.png.

Coincident vertices

Extruding operatess by first creating new vertices and then moving them. If, in the process of moving, you change your mind and press Esc or RMB Template-RMB.png to cancel, the new vertices will still be there, on top of the original ones! The simplest way to go back to the state before you started extruding is to Undo (CtrlZ). However, it is sometimes useful to intentionally create new vertices this way and then move, scale or rotate them by pressing G, S or R.

Gus with arms and legs.

Gus should now have a left arm that you modeled (remember he’s facing us), and a right arm that Blender mirrored from the left one. We will build the left leg the same way by extruding the lower vertices three times. Deselect the left arm by pressing A. Now try to produce something like in (Gus with arms and legs).

If you are using Extrude   »  Region, you will have to temporary disable Do Clipping in the Mirror modifier panel, and recheck it afterward. Otherwise Gus will end up with a skirt rather than pants (because the central vertices would stick to the mirror plane…).

You can free the movement of the extruding vertices by clicking MMB Template-MMB.png after you have pressed E, but before you click LMB Template-LMB.png. If you do not, Gus’s legs will end up going straight down, rather than down and to the side, as in the figure.

The basic shape of Gus’s body is now complete, and we’re finished with mirror modeling. In the next steps we will experiment with other techniques. We need to make the right half of Gus’s body real, since nothing performed by modifiers is permanent unless we apply the changes. With Gus being in Object mode (press ⇆ Tab to leave Edit mode), click on the Apply button of the Mirror modifier.

The Head

Like everybody else, Gus needs a head. Make sure you are in Edit mode (press ⇆ Tab if you need to switch modes).

Move the cursor to exactly one Blender Unit (grid square) above Gus’s body (leftmost image in Giving Gus a head).

Giving Gus a head.

To place the cursor at a specific grid point, position it near to where you want it, then press ⇧ ShiftS to summon the Snap menu. The Cursor ➔ Grid entry places the cursor exactly on a grid point. That’s what we want right now. Cursor ➔ Selection places it exactly on the selected object, which is sometimes handy.

Add a new cube with (Space   »  Add » Cube).

Now, press G to switch to grab mode and move the newly created vertices down, constraining the movement by moving the head (cube) down slightly, along the Z axis, and then clicking MMB Template-MMB.png to limit movement to only the Z axis, for easier positioning.

Move the head down about one third of a grid unit (as in the right-most image in Giving Gus a head).

SubSurface

The Subsurf modifier.

So far, what we have is a rough figure, at best. To make Gus appear smoother, locate the Modifiers panel in the Editing context (F9), and add a Subsurf modifier (The Subsurf modifier). Be sure to set the value of both Levels numeric fields to no more than 2. The first Level affects what is shown in the 3D views, the second is for the renderer.

SubSurfaces
SubSurfacing is an advanced modeling tool, it dynamically refines a given coarse mesh by displaying a much denser mesh and locating its vertices so that they smoothly follow the original coarse mesh. The shape of the object is still controlled by the location of the coarse mesh vertices, but the rendered shape is a finely smoothed mesh.


Switch out of Edit mode (⇆ Tab) and from the current Wireframe drawing mode to Solid mode, using Z, to have a look at Gus. He should look like the left-most image of (Smoothing Gus).

Smoothing Gus.

To apply our smoothing effect to Gus, press the Set Smooth button found in the Link and Materials panel of the Editing context (F9). Gus should now appear smooth.

However, Gus’s body may have some artifacts (black line(s)) down his middle (centre image in Smoothing Gus). This is usually avoided if you used the Mirror modifier, but it might happen when extruding and flipping as it was done before the modifier was introduced.

These artifacts appear because the SubSurf’s finer mesh is computed using information about the directions of the face normals from the coarse mesh model, which may not all point in the right direction. That is, some face normals might point inward instead of all outward.

To reset the face normals:

  1. switch back to Edit mode (⇆ Tab)
  2. select all vertices (A)
  3. press CtrlN
  4. Click with LMB Template-LMB.png on the Recalculate normals outside confirmation dialog which appears

Now Gus should be nice and smooth (right-most image in Smoothing Gus).

Click and hold the MMB Template-MMB.png in the 3D View and drag your mouse around to examine Gus from all angles.

Oops, he’s too thick!

Constrained Scaling

Slimming Gus using constrained scaling.

Let’s make Gus thinner:

  1. Switch to Edit mode by pressing ⇆ Tab if you are not there already, then back to Wireframe drawing mode by pressing Z.
  2. Switch to side view by pressing 3 NumPad and select all vertices with A.

The following steps you can do just as well in Object mode, if you like (even though it has not the same effect, for us the result is the same):

  1. Hit S and start to move the mouse horizontally. Click MMB Template-MMB.png to constrain scaling to just one axis (or press X, Y or, in this case, Z to obtain the same result). If you now move the mouse towards Gus he should become thinner but remain the same height.
  2. The header of the 3D view shows the scaling factor (center image in Slimming Gus using constrained scaling). Press and hold Ctrl. The scale factor will now vary in discrete steps of value 0.1. Scale Gus down so that the factor is 0.2, then confirm this dimension by clicking LMB Template-LMB.png (right image in Slimming Gus using constrained scaling).
  3. Return to front view (1 NumPad) and to Solid drawing (Z), then rotate your view via MMB Template-MMB.png.

Gus looks much better now!

Let’s see what Gus looks like

We’re just about ready to see our first rendering, but before we do, there is some more work to do.

  • Switch to Object mode (⇆ Tab), if not already there.
Selecting both Layers 1 and 10, making their contents visible.
  • ⇧ ShiftLMB Template-LMB.png on the top right small button of the layer visibility buttons in the 3D window header (Making both layer 1 and 10 visible), to make both layer 1 (Gus’s one) and layer 10 (the one with the camera and the lamp) visible.
Blender3D FreeTip.gif
Tip
Remember that the last layer selected is the active layer, so all subsequent additions will automatically be on layer 10.


The Transform Properties panel.
  • Press N to summon the Transform Properties panel (The Transform Properties panel). The location of the selected object is specified by LocX, LocY, and LocZ.
  • Select the camera (RMB Template-RMB.png) and move it to a location like (x=7.0, y=-10.0, z=7.0). One way to do this, is by pressing G and dragging the camera. You may need to change views and move the camera a second time to adjust all three coordinates correctly.

If you prefer to enter numerical values for an object’s location, you can do so by clicking ⇧ ShiftLMB Template-LMB.png on a numeric field and then entering the desired value in the Transform Properties panel. Remember to press ↵ Enter to confirm your input.

Dismiss (close) the Transform Properties panel with the cross in the upper-left corner of the panel.

Camera setup

To point the camera at Gus, ensure the camera is still selected, and add Gus to the selection (⇧ ShiftRMB Template-RMB.png click). The camera should be magenta and Gus light pink. Now press CtrlT and select the TrackTo Constraint entry in the pop-up. This will force the camera to track Gus and always point at him. This means that you can move the camera wherever you want and be sure that Gus will always be in the center of the camera’s view.

Tracking
If you choose the option Old Track and the camera has a rotation of its own, as is often the case, it could point in an unexpected direction. In that case select the tracking object (in our example the camera), and press AltR to reset the object’s rotation. Once you do this the camera will really track Gus.


To obtain a camera view press 0 NumPad, or select View » Camera from the 3D window header. You should be able to see Gus from the camera’s perspective (Gus through the camera lens).

Gus through the camera lens.

Ground Plane

Now we need to create the ground for Gus to stand on.

  • In top view (7 NumPad or View » Top), and in Object mode, add a plane mesh (Space   »  Add » Mesh » Plane).
Note
It is important to be out of Edit mode, otherwise the newly added object would be part of the object currently edited, as when we added Gus’s head.


  • Switch to the front view (1 NumPad or View » Front) and move (G) the plane down to Gus’s feet, using Ctrl to keep it aligned with Gus.
  • Switch to camera view (0 NumPad or View » Camera) and, with the plane still selected, press S to start scaling.
  • Enlarge the plane so that its edges extend beyond the camera viewing area, as indicated by the outer black dashed rectangle in camera view.

Lights

Now, lets add some light!

  • In top view (7 NumPad), move the existing lamp light (if you do not have a lamp light in your scene you can add one with Space   »  Add » Lamp » Lamp) in front of Gus, but on the other side of the camera – for example to (x=-9.0, y=-10.0, z=7.0) (Inserting a Lamp).
Inserting a lamp.
The Lamp sub-context button in the Buttons window.
  • Switch to the Shading context (F5) and Lamp sub-context (the “lamp” button in the Buttons window header, see The Lamp sub-context button in the Buttons window).


  • In the Buttons window, Preview panel, press the Spot toggle button to make the lamp a spotlight of pale yellow (R=1.0, G=1.0, B=0.9). Adjust Samples to 4 and SpotBl to 1.0 (Spot light settings).
Spot light settings.
  • Make this spotlight track Gus just as you did for the camera by selecting the lamp, clicking ⇧ ShiftRMB Template-RMB.png on Gus, and then pressing CtrlT   »  TrackTo Constraint.
  • Add a second lamp that provides more uniform fill light via (Space   »  Add » Lamp » Hemi). Set its Energy to 0.5 (Hemi lamp settings). Move it a little above the camera (x=7.0, y=-10.0, z=9.0) and set it to track Gus as before.
Hemi lamp settings.
Two lamps?
Use two or more lamps to help produce soft, realistic lighting, because in reality natural light never comes from a single point.


Rendering

The Render sub-context button in the Buttons window header.

We’re almost ready to render. As a first step, press the Scene context button and the Render sub-context button in the Buttons window header (The Rendering buttons window buttons.).

We will use the default rendering settings, as shown in (The Render sub-context of the Buttons window).

The Render sub-context of the Buttons window.

Now press the RENDER button or hit F12. The result, shown in (Your first rendering. Congratulations!), is actually quite poor. We still need materials, and lots of details, such as eyes, and so on.

Your first rendering. Congratulations!

Saving your work

The Save entry of the File menu.

If you have not done so already, now would be a good time to save your work, via the File » Save menu entry, or CtrlW. Blender will warn you if you try to overwrite an existing file.

Blender performes automatic saves, storing them in your system’s temporary directory. By default, this happens every five minutes and the file name is a number. Loading these saves is another way to undo unwanted changes.

Materials and Textures

It’s time to give Gus some nice cookie-like material.

The Material sub-context button in the Buttons window header.
  • Select Gus. Then, in the Buttons window header, select the Shading context (F5), and press the “red dot” Material sub-context button.


The Links and Pipeline panel of an object without any material.
  • The Buttons window will be almost empty because Gus has no materials yet. To add a material, click on the Add New button in the Links and Pipeline panel.


  • The Buttons window will be populated by panels and buttons, and a text field holding the material name, something like “Material.001”, will replace the Add New button. Click the name and change it to something meaningful, like “GingerBread” (without the quotes!).
  • Modify the default values as shown in (Gus’s gingerbread material settings) to obtain a first rough material. Note that you must click the Shaders tab to reveal the Shaders panel. You might want to click on the picture to be able to enlarge it and see the details.
Gus’s gingerbread material settings.
The Texture panel.
  • Click on the Add New button in the Textures panel. We’re adding a texture in the first channel. Call it “GingerTex”.


The Texture sub-context button in the Buttons window header.
  • Switch to the Texture sub-context by clicking the “leopardskin” button, or by hitting F6.


  • In the Texture Type drop-down list of the Texture panel, select Stucci and set all parameters as in (Gus’s main gingerbread texture settings).
Gus’s main gingerbread texture settings.
  • Return to the Material sub-context (F5) and set the Map Input and Map To panels’ settings. Release the Col toggle button and enable the Nor one, then raise the Nor slider to 0.75. These changes will make our stucci texture act as a “bumpmap” (to fake relief on a smooth surface), and make Gus look more biscuit-like.
Map To and Map Input panels for GingerTex texture.
  • Now add a second texture, name it “Grain”, and make it affect only the Ref property with a 0.4 Var (Settings for an additional noise texture in channel 2). The texture itself is a plain Noise texture type.
Settings for an additional noise texture in channel 2.
  • Give the ground an appropriate material, such as the dark blue one shown in (A very simple material for the ground).
A very simple material for the ground.

Eyes and details

To give some finishing touches, we’ll add eyes and some other details.

Layer buttons in 3D header.
  • First, make layer 1 the only one visible by clicking LMB Template-LMB.png on its button (Layer buttons in 3D header). This will hide the lamps, camera, and ground.
  • Place the cursor at the center of Gus’s head (remember that you are in 3D, so be sure to check at least two views to be sure!).
  • In Object mode, add a sphere (Space   »  Add » Mesh » UVsphere). You will be asked for the number of Segments (meridians) and Rings (parallels) into which to divide the sphere. The default of 32 is more than we need here, so use a value of 16 for both. The sphere is in the top left picture in (Sequence for eyes’ creation).
  • Scale the sphere down (S) to a factor of about 0.15 in all dimensions, then switch to side view (3 NumPad) and scale it only in the horizontal direction (Y) a further 0.5, see the second two images in (Sequence for eyes’ creation).
Sequence for eyes’ creation.
  • Zoom a little if necessary via + NumPad, Wheel Template-MW.png, or CtrlMMB Template-MMB.png, and drag the sphere (G) to the left so that it is halfway into the head, as shown in the first image in the second row of (Sequence for eyes’ creation).
  • Return to front view (1 NumPad) and move the sphere sideways, to the right. Place it where Gus should have an eye!

Duplicating and mirroring around the cursor

  • Switch to Edit mode (⇆ Tab). Select the “crosshair” 3D Cursor in the 3D window header’s Pivot drop-down list (The “crosshair” Pivot button). The eye’s vertices should still be selected (if not, press A to select them all). Now press ⇧ ShiftD to duplicate and Esc to immediately quit “grab” mode. Then press M to mirror, X to mirror along the X axis, followed by LMB Template-LMB.png or ↵ Enter to confirm the mirror. Return the Pivot setting to its default Median Point value.
The “crosshair” Pivot button.
Mirroring
Mirroring can also be done in Object mode using CtrlM.


Now Gus has two eyes.

Mouth

  • Exit Edit mode (⇆ Tab), and place the cursor as close as you can (remember the ⇧ ShiftS key) to the center of Gus’s face. Add a new sphere and scale and move it exactly as done before for the eyes, except make its overall scale smaller (0.1 instead of 0.15). Place it below and to the right of the cursor, centered on the SubSurfed mesh vertex, as shown in the middle frame in (Creating a mouth with spinning tools).
Creating a mouth with spinning tools.
The spin buttons in the Editing context of the Buttons window.
  • Switch back to Edit mode (⇆ Tab). Now, in the Editing context (F9), locate the group of buttons at bottom in the Mesh Tools panel (The spin buttons in the Editing context of the Buttons window). Set Degr to 90, Steps to 3, and verify that Clockwise is on. Then, with all vertices still selected, press SpinDup. This will create three duplicates of the selected vertices on an arc of 90 degrees, centered around the cursor. The result should be Gus’s mouth, like the last image in (Creating a mouth with spinning tools).


The complete Gus!
  • Now go back to Object mode and add three more spheres (below the head and centered along the Z-axis) to form Gus’s buttons. Once you have made one button, you can simply exit Edit mode, press ⇧ ShiftD to create a duplicate, and move it into place, as shown in (The complete Gus!).
Attaching the spheres
If we want to be able to grab Gus and move him around as a whole (this goes beyond the animation in the second part of this tutorial), we now need to attach the small spheres representing eyes, mouth, and buttons to the body. Enter Object mode and press A until nothing is selected. Now click RMB Template-RMB.png one sphere (if more than one are selected as they form a single object, like the eyes, that’s OK). Holding ⇧ Shift, select the body. Then hit CtrlP and click Make parent on the confirmation pop-up. Deselect everything and repeat the process to attach each element.


Eyes’ material

Give the eyes a chocolate-like material, like the one shown at the top in (Some candy materials). Give the mouth a white sugar-like material, like the second one shown in (Some candy materials), and give the buttons a red, white, and green sugar-like material. These are shown from top to bottom in (Some candy materials) too.

Some candy materials.
Material drop-down list.
Objects sharing a material
To give one object the same material as another object, select that material in the “material” drop-down list which appears when you press the “two arrows” button to the left of material’s name, in the Links and Pipeline panel, see (Material drop-down list).


Rendering

Once you have finished assigning materials, make layer 10 visible again (remember how? Hint, look at the 3D window header), so that lights, camera and ground also appear, and do a new rendering (F12).

The result should look more or less like (The complete Gus still rendering).

The complete Gus still rendering.

Saving

File type selection menu in the Render context of the Buttons window.

Save your image by pressing F3. Enter the name of your image in the file window and save.

You must choose the image format (JPEG, PNG, and so on) by setting it in the Render context before pressing F3, using the Save image as menu in the Format panel (File type selection menu in the Render context of the Buttons window).

By default, Blender does add the relevant extension to the file name, so you don’t have to bother with this.