利用者:Stuntman/Extensions:2.6/Py/Scripts/Mesh/weightloss

提供: wiki
移動先: 案内検索
Weight Loss
Prunes the count of non-zero weight bone influences
UI location View3D > Tool Shelf > Weight Loss
Version 1.1 Author(s) Stuntman, (acknowledgement to GorkaMendieta for idea)
Blender 2.63 License GPL


Executable information
File name mesh_weightloss.py
Current version download http://projects.blender.org/tracker/download.php/153/467/31436/20738/mesh_weightloss.py
Python modules sys


Installation

  • Download the script and copy to the Blender scripts/addons directory.
  • In User Preferences select the Add-Ons tab.
  • You can activate the script there.
  • The script will now show up in the Object Tool Shelf (press T in object mode)

Description

Most real time game engines have restrictions on the number of bone influences, typically 4, allowed on a single vertex. When importing a Blender file excess influences beyond this limit are not imported.

This difference could be ignored as trivial, and many skilled Blender users will not worry about or generally produce models that have significant numbers of bone influences. However, for completeness sake the Weight Loss add-on provides the user with the option to zero the weights of any influences above a user specified count.

The default Blender UI provides a number of different weight tools, of particular relevance to Weight Loss is the Clean function. Clean removes all influences (removes a vertex from a vertex group) where the weight value is below a user specifiable value.

Without examining every vertex, and every vertex group we don't know how many influences a Clean will retain for each vertex. Without knowing what a suitable threshold value is to clean below it is not possible to clean and guarantee that you will have below a required number of influences on every vertex.

This is where Weight Loss coupled with Clean comes in.

Example


Mesh weightloss image1 grouplist.png





The detail to the right is for a single vertex with 6 non-zero weight bone influences. We may set the clean threshold to be 0.001 but for this vertex, that would still leave 5 influences (ok so 0.001 is small, but for illustration purposes it hopefully demonstrates the principle).


Mesh weightloss image2 toolbar.png




After installing the Weight Loss add on, in 3D View select your mesh in Object Mode, the Weight Loss panel appears in the Object Tools.


Set your Maximum Count of influences (e.g. 4) and then press the button to Prune Weights. This will reduce the number of non-zero weights on all vertices to less than or equal to the maximum count set. You will be informed of how many influences have been set in the mesh in the information panel.

Mesh weightloss image3 infobar.png



Mesh weightloss image4 grouplist.png





Back to our example, we have only 4 non-zero infleunces now for this vertex, and likewise for every vertex in the mesh we will have 4 or less non-zero influences.

Next perform a Clean, with a very small threshold value, and when applied all of the zero weight influences (previously existing and new as a result of the Weight Loss calculation) will be removed.

For subsequent animations on the model using Blender imported in to the target games engine the user will at least be confident that any difference or deformation between animations on the two software tools will not be as a result of different numbers of bone influences.

Known Issues


Additional Information


Support


Links