Closest Point Weight Mirror

by Ben Morgan in Addons


How it Works

My weight mirror method does a targeted data transfer between a duplicated and mirrored instance of the original mesh. This makes the technique both fast and accurate, as Blender's data transfer method is both fast and does a great job at filling in islands and interpolating data. Mirroring a single vertex group is almost instant, and mirroring all vertex groups on a heavy mesh takes about half a second.

Only one data transfer is called per joint, instead of other techniques which may do calculations per-vertex. Doing fewer calls and letting vanilla Blender calls do the bulk of the work allows this technique to be both efficient and versatile. 

How to Install It

Install this add-on by going to Edit > Preferences > Add-ons and hitting the Install button. Browse to the python file in this repository called bmst_closest_point_mirror.py

How to Use It

These operations have been exposed in the UI in the Vertex Group Specials menu under Properties > Object Data Properties > Vertex Groups

They are called Mirror Active Vertex Group (Closest Point) and Mirror All Vertex Groups (Closest Point)

Your armature should be at origin and at rest pose before mirroring.

Mirror Active Vertex Group (Closest Point) - Mirrors the currently active vertex group. Creates the opposite-side vertex group if it doesn't exist. 

(example) Select upperArm.l and hit this if you want to mirror weights to upperArm.r

Note: This technique will completely replace the weights on the destination side.

Mirror All Vertex Groups (Closest Point) - Mirrors all left-sided vertex group weights to the right, and all center-sided vertex group weights within themselves.

Also blends the weights into and out of the mirror plane for a better transition. Adjust this blend using the Center Blend Width parameter. 

Calling them Directly

You can also call these operations directly in Python with the following commands:

bpy.ops.object.bmst_mirror_active_vertex_group_closest_point()

or

bpy.ops.object.bmst_mirror_all_vertex_groups_closest_point()

More details

Mirrors the given vertex groups, regardless of if the mesh is symmetrical or not, by running a single Data Transfer op from a mirrored version of the original mesh. This makes the process much more accurate and fast.


On center-sided vertex groups (those that contain the given center_key), opposite-sided vertex group weights are removed and weights near the mirror plane are linearly blended across that plane if they are within the given center_blend_width. This removes artifacts that may occur by doubling up weights near the center.

This function is expected to be run on a mesh at origin, but should™ work with the mesh offset. 

Parameter Details

Left Pattern : A string to identify left-sided bones.

Right Pattern : A string to identify right-sided bones.

Center Pattern : A string to identify center-sided bones.

Mirror Plane : The plane to mirror across.

Mirror Direction : Determines which side of the mirror plane will be chosen as the source.

Weight Distribution Method : How to distribute weights from hit locations.

Barycentric uses a technique that interpolates weight values based on their relative distance to the vertices of the polygon they hit.

Closest Vertex distributes 100% of the source vertex's weights to the closest vertex on the hit polygon.

Center Blend Width : The width of the linear blend technique. You may need to adjust this depending on the scale of the mesh you are working on.


Enjoy

Ben Morgan

Sales 200+
Customer Ratings 11
Average Rating
Dev Fund Contributor
Published over 2 years ago
Blender Version 2.93, 3.0
License GPL
Have questions before purchasing?

Contact the Creator with your questions right now.

Login to Message