Blender 3D: Noob to Pro/Advanced Tutorials/Advanced Animation/Guided tour/Mesh/vg

From Wikibooks, open books for an open world
Jump to navigation Jump to search

What Are Vertex Groups?[edit | edit source]

Vertex groups are very useful. You can use a vertex group to:

  • Group vertices together while you model (keep a selection and come back to it later).
  • Define which vertices softbody simulation affects.
  • Define which vertices emit particles.
  • Define which part of a mesh will follow a specific bone.

Vertex groups are specific to the Mesh object and can be modified in Editmode.

If you have vertices assigned to multiple groups (for example, in a character you may have some vertices in the "upper arm" vertex group that are also in the "lower arm" vertex group), you can assign weights to those vertices to specify how much relative influence the different groups have. A weight can range from 0 to 1 and is assigned when you create the group. Let's take a peek at the GUI of vertex groups in the Editbutton(F9KEY):

From top down:

  • The dropdown menu lets you select an existing vertex group or rename the current one.
  • The weight numfield lets you choose the weight value assigned when you add vertices.
  • You can add a new group or delete the current one.
  • Assign or remove selected vertices to/from current group.
  • Select/deselect all vertices in current group.

Weight Paint[edit | edit source]

As mentioned above, you may often find that you have some vertices that are assigned to more than one vertex group. By assigning weights, you can specify the relative influence each of the vertex groups have. You have two options to assign weights: 1) manually selecting each vertex and typing in a weight value, or 2) use weight painting to - you guessed it - paint weights.

Weight painting lets you paint weight values on the mesh like you were painting on a wall with a can of spray paint. It is a Mode of the 3Dview and is accessible in the 3Dview's header in the dropdown menu with Objectmode, Editmode and such. A hotkey is also available: CTRL-TABKEY.

In Weightpaint Mode, the first thing you'll notice is the blue color of the mesh. Blender provides an easy way to quickly visualise the weight value of each vertex. This is the color spectrum used:

When you are in Weightpaint mode you can paint all over the mesh as if it was a solid object on your desk. The paint only works on vertices so don't try to paint in the middle of an edge or a face, it will never work. To help you in your task there is a new panel in Editbutton:

  • The weight slider is just the same thing as the weight numfield we saw earlier in the vertex groups button. It's just easier to work with. It's simply the weight you want to apply to the vertices. In painting terms, think of this as the color.
  • The buttons from 0 to 1 are shortcuts for weight value, to speed up the workflow.
  • The opacity slider (and shortcuts) tell Blender what is the percent of the weight value you want to apply in one shot. If you set opacity and weight to 1 the vertex will turn red instantly. In painting terms, think of this as the pressure.
  • "All faces" tells Blender if you want to paint on all faces in the mesh or just the visible one.
  • "Vertex Dist" tells blender to use vertex distance instead of faces. When active, the painting will only check if the vertex is in the brush, then apply a weight value. If it's off, all vertices part of the faces in the brush will receive weight value. Turning on Vertex Dist can give good results when you have a lot of polys in your mesh.
  • "Normals" will apply vertex normals before painting. This means Blender will take consideration of the direction the vertex is pointing when painting: the more it's facing away from view, the less it will receive value.
  • "Spray" really makes it like spraying paint. Without it, a single click will only paint one value. With Spray on, each time you move the mouse a paint shot will be added. To get a good effect, use a small opacity value so the weight will increase slowly.
  • "X-mirror" will tell Blender to apply the weight paint on the other group if there is one. Like Hand.L --> Hand.R. If you paint the group hand.L and there is a hand.R the paint will be copied over. For this to work your groups must be created, the name of the groups have to follow name's convention (left right) and both side of the mesh need to be identical.
  • "Wire toggle" toggles the visibility of wire while painting. Useful to find where the vertices are (activate the edit mode option "Draw all edges" to see even better).
  • "Mix"/"Add"/"Sub"/"Mul"/"Filter" is how you want to apply the paint based on what is already there. Mixing will do a mean from brute weight value and current weight value, "Add"/"Sub" will directly add or subtract value, "Mul" will multiply (exponential painting) and "Filter" will paint based on alpha value.

Vertex Groups and Armatures[edit | edit source]

So what use are vertex groups in rigging? You can specify what vertices will move when a bone moves. When you want to paint a mesh for an armature, do the following:

  • Make sure the Mesh has an Armature modifier.
  • Select the armature and enable Armature Posemode (CTRL-TABKEY).
  • Select the mesh and enter Weightpaint mode (CTRL-TABKEY). (Question: if we're in Pose Mode for the Armature, how are we supposed to select the mesh? Ans: right click on it.)
  • Select the bone you want to paint for with RMB.
  • Paint the parts you want that bone to affect.

You'll notice that, if there is no group created when you first paint, Blender will create a group for you, and give it the same name as the selected bone. This is important, because when the "Vert. Groups" toggle is on in the Armature modifier, Blender will try to match bones with Vertex Groups based on the same names.

What happens when we try to blend groups together? See this simple example of 2 bones trying to bend a tube:

The Groups are painted so the body of each bone is in red and the zone between the two bones are gradually going from 1 to 0. This will bend nicely. If, for a special reason, you want a side to react differently, you can always move the bone while painting and try the new modification you just did. By the way, having Subsurf on while painting can be very cpu expensive. It's a good idea to turn it off.

Using Weight Painting with Armatures[edit | edit source]

Armatures are used for many purposes, but one common use is to deform a mesh with an armature. This example will demonstrate how weight painting can improve armature-deformed meshes.

In this example, we have two objects; each has an armature modifier applied. The one on the left is going to be the "before" and the one on the right will be the "after".

The two objects in this example.

For the object on the left, take a look at the vertex groups as initially assigned (from left to right: Bone1, Bone2, Bone3, and Bone4). These same vertex groups were assigned for the object on the right:

Vertex group assignments for each of the two objects.

Important: A bone in an armature will only act upon those vertices that are in a vertex group with exactly the same name as the bone.

  • In Blender 2.37 and previous, this was the ONLY way to get a bone to deform a mesh.
  • In Blender 2.40 and on, selecting the "Envelope" button in the armature modifier will allow bones to deform even if you haven't assigned any vertex groups yet.

If you enter Weight Paint mode (CTRL-TAB with object selected) right after assigning the vertex groups, you can see that the vertex groups as assigned all have a weight of 1.0:

Initial weights for the vertex groups assigned above.

OK: both objects have vertex groups assigned and they have armature modifiers. Let's grab a bone (select the Armature, CTRL-TAB to enter Pose Mode, select Bone4, GKEY to grab, and move) to deform the mesh. We haven't made the objects different from each other, so after moving their armatures in the same way . . there's still no difference. That's good.

Armatures deforming objects: before weight painting