Sub topic 11
Cleaning and smoothing weights
After auto weights and some painting, a mesh usually carries leftover data: near-zero weights that do nothing visible, vertices with more influences than your target engine accepts, and rough patches where neighbouring vertices have unrelated values. This chapter covers the tools that fix these without repainting by hand: Clean, Limit Total and Smooth.
It assumes you can already bind a mesh with automatic weights, read the Weight Paint colors, use the Blur brush, and run Normalize All. If any of those are unfamiliar, review the earlier chapters first.
Why weights need cleaning
A vertex group stores a weight only for vertices that were assigned to it. Auto weights and painting create many assignments with tiny values, such as 0.002 or 0.0. These cause three problems:
- Hidden influences. A weight of 0.003 has no visible effect, but it still counts as an influence. A vertex may then exceed the four-bone limit that many game engines enforce.
- Noisy data. Export formats and other tools must store or discard these values, and the choice may differ between tools.
- Confusing results. Stray weights show up as faint blue specks or odd values when you inspect a vertex.
Smoothing addresses a different problem. Weights can be valid and still change too sharply from one vertex to the next, which creates creases when the joint bends.
The Clean operator
Clean removes weights at or below a threshold. In Weight Paint mode it is under Weights > Clean. After you run it, the Adjust Last Operation panel shows these options:
| Option | Meaning |
|---|---|
| Subset | Which groups to process: All Groups, Active Group, Selected Pose Bones, or Deform Pose Bones |
| Limit | Weights at or below this value are removed. The default of 0.0 removes only zero weights |
| Keep Single | Never removes a vertex's last remaining weight, so no vertex ends up with no influence |
Useful values depend on your goal:
- 0.0: removes only assignments that are already zero. This is safe and invisible.
- 0.01 to 0.05: removes weak influences. A threshold of 0.01 is a good starting point for general cleanup.
- Above 0.1: begins to change the look of the deformation. Check the pose afterward.
Turn on Keep Single when you use a high limit. Without it, a vertex whose only weight is 0.04 loses that weight entirely and stays behind when the skeleton moves.
Limit Total
Limit Total caps the number of influences per vertex. It keeps the strongest weights and drops the rest. In Weight Paint mode it is under Weights > Limit Total, and the Limit value is the maximum number of groups per vertex (4 is typical for games).
Clean and Limit Total solve different problems:
- Clean removes by value: anything below the threshold goes.
- Limit Total removes by rank: the weakest influences go until only N remain, however large they are.
A vertex with five influences of 0.2 each is untouched by Clean at 0.05 but is cut to four by Limit Total. That fifth influence was real and visible, so check the pose after limiting.
The Smooth operator
Smooth, under Weights > Smooth, averages each vertex's weights with those of its neighbours. It is an operator on the stored data, unlike the Blur brush, which paints where you drag the cursor. Its options are:
| Option | Meaning |
|---|---|
| Subset | Which groups to smooth |
| Factor | How strongly each pass blends toward the neighbour average (0 to 1) |
| Iterations | How many times the pass repeats |
| Expand/Contract | Grows or shrinks the weighted area. Positive values spread the weight, negative values pull it in |
Higher factors and more iterations spread weight further. Use them to soften a hard edge, such as the boundary between the upper arm and the forearm groups.
Smooth versus the Blur brush
| Situation | Better tool |
|---|---|
| One rough patch near a joint | Blur brush |
| A whole region, such as the full elbow ring | Smooth operator with a selection |
| You need repeatable, scriptable results | Smooth operator |
| You want to feather by hand with varying strength | Blur brush |
The operator gives identical results every time you run it with the same settings, so it suits scripts and batch work.
A cleanup order that holds up
The order matters because each step changes the data the next one sees.
Smoothing comes first because it spreads small weights across many vertices and can create new influences. Limiting and cleaning then remove them. Normalizing goes last among the data steps, because every removal changes the sums.
Doing it from Python
The same operators are available in scripts. This script runs the full sequence on the active mesh.
import bpy
obj = bpy.context.active_object
assert obj is not None and obj.type == 'MESH', "Make a mesh the active object."
bpy.ops.object.mode_set(mode='WEIGHT_PAINT')
# Smooth lightly, limit influences, drop small weights, then renormalize.
bpy.ops.object.vertex_group_smooth(group_select_mode='ALL', factor=0.5, repeat=2, expand=0.0)
bpy.ops.object.vertex_group_limit_total(group_select_mode='ALL', limit=4)
bpy.ops.object.vertex_group_clean(group_select_mode='ALL', limit=0.01, keep_single=True)
bpy.ops.object.vertex_group_normalize_all(group_select_mode='ALL', lock_active=False)
bpy.ops.object.mode_set(mode='OBJECT')Run it from the Text Editor with the mesh active. In scripts, the repeat argument corresponds to the Iterations option in the panel.
To check the result without changing anything, count influences directly from the data:
import bpy
obj = bpy.context.active_object
threshold = 0.01
max_influences = 0
tiny = 0
unnormalized = 0
for v in obj.data.vertices:
max_influences = max(max_influences, len(v.groups))
total = 0.0
for g in v.groups:
total += g.weight
if g.weight <= threshold:
tiny += 1
if v.groups and abs(total - 1.0) > 0.001:
unnormalized += 1
print("Max influences on one vertex:", max_influences)
print("Weights at or below", threshold, ":", tiny)
print("Vertices whose weights do not sum to 1:", unnormalized)After a correct cleanup, the second and third numbers should be zero and the first should not exceed your limit. Vertices with no groups at all are skipped in the sum check, since they are a different problem (see the troubleshooting chapter).
Edge cases and common mistakes
- Locked groups. Locked vertex groups are not modified by these operators. If a group seems to be ignored, check its lock icon in the Vertex Groups list.
- Subset choice. With Subset set to Selected Pose Bones, only groups for bones selected in Pose Mode are processed. If you are in Weight Paint mode with no bone selected, nothing happens, and it can look like the operator failed.
- Non-deforming bones. Deform Pose Bones skips groups for bones with Deform turned off. That is usually what you want, because helper bones such as IK targets should not carry weight data.
- Repeated smoothing. Many iterations at a high factor flatten the weights until a joint looks rubbery. Prefer two or three light passes over one aggressive pass.
- Clean on a symmetric mesh. Clean and Smooth treat each side independently, so tiny differences can appear between left and right. Re-run the mirror step afterward if symmetry matters.
Verifying in Pose Mode
Cleaning should not change how the mesh looks in the pose. After the sequence, switch to Pose Mode and bend the same joints you tested before. Compare the elbow, knee, shoulder and neck. If a region now collapses or pops, raise the Clean limit's safety margin by lowering the value, or raise the Limit Total value, then repeat.
Exercise
A vertex has weights 0.55, 0.40 and 0.03 across three groups. You run Clean with Limit 0.05 and Keep Single on, and nothing else. What are the weights afterward, and what must you do next?
Show answer
The 0.03 weight is removed, leaving 0.55 and 0.40, which sum to 0.95. Clean does not renormalize, so run Normalize All to bring the total back to 1.0 (about 0.579 and 0.421).
Exercise
Your game engine allows four bone influences. One vertex has five influences of 0.2 each. Will Clean with Limit 0.05 fix it? If not, which operator will?
Show answer
No. All five weights are above 0.05, so Clean leaves them alone. Limit Total with a limit of 4 removes the weakest influence, and Normalize All then rescales the rest.
Exercise
Why should you select the problem area before running Smooth, and why run Smooth before Limit Total in a cleanup sequence?
Show answer
Without a selection, Smooth changes every vertex, including regions you already painted well. Smooth runs first because it spreads weight and can add small new influences, which Limit Total and Clean can then remove.