From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

GSoC 2011: Weight Painting Upgrades Project

SVN

https://svn.blender.org/svnroot/bf-blender/branches/soc-2011-radish

Manual

The guide to the Weight Paint Upgrades of GSoC 2011: Jason Hays

Locking

What is locking for?

-Locking is used to preserve the effect a bone has on a set of vertices while allowing other existing weights on the same vertices to be modified.

How does it work?

-When a vertex that belongs to a locked bone group is modified in an unlocked group, that change must be redistributed to other unlocked groups to preserve the effect of the locked group.

How do I lock/unlock a group?

-You can lock any group with the checkboxes that appear next to the vertex groups.
Only bone groups will accept redistributed change, and only they will cause change to be redistributed.

(Misc groups can be locked, but it only prevents you from changing them directly)

-There are also 3 buttons available to quickly change the locks: Lock All, Invert Locks, and Unlock All.

Multi-Paint

What can I do with Multi-Paint?

-Multi-Paint allows you to paint over bones while maintaining the ratio between each bone.

-It is also compatible with lock, so changes will be redistributed back onto the vertices while still keeping the ratios.

How do I use Multi-Paint?

-To activate Multi-Paint, go into Weight Paint's sidebar, and find the Multi-Paint checkbox under Auto Normalize.

-To utilize it, extend the selection to include the bones you wish to paint across (Shift+RMB), and start painting!

Fix Deforms

-Fix deforms can be used to change the position of a vertex by only modifying its nonzero weights.

-When complex models are deformed to their most extreme poses, they are often visibly bumpy, jagged, or otherwise incorrectly deformed.

-You can smooth over the deformation, or make it moreso jagged with the fix deforms op.

How do I use it?

-First, select the vertices that need adjusting either in Edit Mode or by using the vertex selection/mask in Weight Paint Mode's header
-Under the Weight Tools tab, you should see Fix Deforms

-Make sure that any mirror modifiers are disabled--while using the op
--they are currently unsupported, but can be reactivated afterwards.

-By default, it will attempt to make it completely flat, by being a distance of 0 away from a plane created by the surrounding points.

-You can change the distance you want it to be away from the plane.
-Also, you can change the percentage it moves towards that distance with Strength.

-Change Sensitivity is the amount that it will attempt to modify the weight by behind the scenes
--different values can make it reach different end positions if you cannot find the correct position with Strength and Distance alone. (You should only need to change this option if you are really, really picky :) )

-Note that if it does not change, then there are no nonzero bone weights that changed to make it closer to the intended distance.

More Project Info

Locking Screen-cast

http://www.youtube.com/watch?v=I79Q6sOWnaE

Multi-Paint Screen-cast

http://www.youtube.com/watch?v=_NFVGzvODNw

To-do list for week 12

1) Fix WP selection tools--done.
2) Document.

What has been accomplished?

-The vertex group locking system (along with its simple checkbox ui) is in place to protect the deformations of locked bone groups while painting.
-Multiple bones are selectable, and Multi-Paint is available--I think it is good to go; although, I haven't heard from the requester in a long time.
-Vertices are select-able in Weight Paint Mode. The standard lasso, box, and circle select tools are also operational.
Vertex selections can be used for masking any of the weight tool operators, the brushes, and set weight.
-The Fix Deforms op was added, and can be used to help correct the position of vertices by only adjusting nonzero bone weights.

What does locking a vertex group do to preserve deformations?

A few things happen when a vertex group is locked:
1) You cannot alter the group's weights by painting over it while it is the active group.
2) When shared vertices belonging to a different group are painted, it will only permit so much change.

To elaborate, the amount of change that can occur is the same as the amount of weight you can move onto other unlocked groups to negate the detrimental effects which would normally occur as a result of the change.

Examples

Simplistic Scenario

Let's say that there are 3 deform groups with values 0.1, 0.5, and 0.4
If the first group is considered 'locked,' and I try to reduce value of the second deform group to 0, Blender will redistribute that 0.5 back onto the other unlocked group.
That would leave us with weights of 0.1, 0.0, and 0.9

Auto Normalize

If the weights were 0.1, 0.7, and 0.4 when I tried painting the second group to 0, some of the weight may come back onto the changed group because there is not enough space left on 0.4
If auto normalize is not active, the result will be 0.1, 0.1, 1

If it was active, the result will be similar to 0.09, 0, 0.91. This is acceptable because the actual value of the locked group is less important than the ratio of the value to the sum of the unlocked groups.

What is Multi-Paint?

Multi-Paint is the ability to paint the weights of multiple selected vertex groups associated with bones while maintaining the weight ratios between them.

How are the weights of the selected groups changed with Multi-Paint?

First of all, it is imperative that the groups maintain the weight ratios - without that, Multi-Paint is nothing more than a faster 'Levels' tool.
1) Get the change that the brushing would have caused normally (call it c).
2) Obtain the sum of the selected groups (call it 'x'), if x is 0 or x+c is < 0, do not continue to multi-paint.
3) factor = (x+c)/x
4) Make sure that the highest value after multiplying any selected group is 1 and that none of them will be zero.
5) Multiply each selected group's weight by the factor.

Smoothing

Here's what happens:
-Vertex A is set to be smoothed.
-The user can define and adjust the desired distance away from the plane created by vertex A's surrounding vertices as well as the strength.
-It's surrounding vertices are averaged to give a 'center point' for a plane.
-A normal is calculated using the 'center' and vertex A (it is the direction from the center to vertex A).
-The each weight of vertex A is adjusted up and down by a scale value to see which is closer, and if the result is closer.
-The weight that causes the most significant vertical change and is closer than before is used.
-Repeat the weight adjustment step, apply the best change, stop when it stops getting closer.