working with weights-skinning - new script(edited)

General discussion about the development of the open source Blender

Moderators: jesterKing, stiv

Post Reply
pildanovak
Posts: 18
Joined: Fri Oct 25, 2002 9:32 am
Contact:

working with weights-skinning - new script(edited)

Post by pildanovak »

Hello, are there any proposals for working with the vertex weights for skinning in Blender?
I'm writing a script for smoothing the weights between bones, and have found that it would be really useful to make some changes in how the weights are displayed.
It would be great, if the weights could be displayed all at once, e.g. each bone would have a random color, and the colors would be blended between each othor according to the weights.
But a good start could be also if the way it is now displayed would be somehow enabled in edit mode, so that the script could run on selected vertices.
The best way to implement this all would be if it could run as a brush- same as painting weights, but not painting, just smoothing the existing ones. If there's someone who would be able and willing to write this in c, please let me know, so that i don't waste my time.
Last edited by pildanovak on Tue Jul 20, 2004 12:29 pm, edited 1 time in total.

z3r0_d
Posts: 289
Joined: Wed Oct 16, 2002 2:38 am
Contact:

Re: working with weights-skinning

Post by z3r0_d »

pildanovak wrote:It would be great, if the weights could be displayed all at once, e.g. each bone would have a random color, and the colors would be blended between each othor according to the weights.
you mean like xsi?
http://roger.rosa.free.fr/resources/tut ... velope.jpg
[first pic I found, from xsi 2.0. in current version I think you can see the mesh's wire in yellow, and in edit mode the verts are still colored. XSI uses white to indicate selection sometimes, red other times]
pildanovak wrote:But a good start could be also if the way it is now displayed would be somehow enabled in edit mode, so that the script could run on selected vertices.
The best way to implement this all would be if it could run as a brush- same as painting weights, but not painting, just smoothing the existing ones. If there's someone who would be able and willing to write this in c, please let me know, so that i don't waste my time.
personally what I want with weight painting is a normalization of the weights, so I don't have to think about two groups each having a weight of 0.75 on one bone ending up so that both groups have an equal effect on the bone.

a way to smooth [smudge?] the vertex groups would be gravy

vertex groups are a pain only being able to paint one at a time.....

pildanovak
Posts: 18
Joined: Fri Oct 25, 2002 9:32 am
Contact:

Post by pildanovak »

and.... here comes the script!!!!

http://server.ffa.vutbr.cz/~novak/files ... tGroups.py

it enables you to: smooth either all groups, 1 or 2 groups or only selected vertices, or work with both/ smooth selected verts from 1 or 2 groups.
Please, reply, if you think the script is usefull. (i believe it is...)
You have just to copy it into blender scripts directory, it will be available from the Misc menu in the script menu.

z3r0_d wrote
you mean like xsi?
http://roger.rosa.free.fr/resources/tut ... velope.jpg
[first pic I found, from xsi 2.0. in current version I think you can see the mesh's wire in yellow, and in edit mode the verts are still colored. XSI uses white to indicate selection sometimes, red other times]
yes, i mean like xsi.

z3r0_d wrote
personally what I want with weight painting is a normalization of the weights, so I don't have to think about two groups each having a weight of 0.75 on one bone ending up so that both groups have an equal effect on the bone.
yes, i could add this by a single line, i think...

things I would propose, if anybody would like to integrate this in the C in Blender, or would just changing the groups code:
1)weight groups should be separated from the vertex selection groups.(you wouldn't have to store weights for v.selection groups)
2)They should be written in a table(so all vertices have a weight of each group) - why? Accesing the data would be much faster and simplier, for the price of some memory(all advanced 3d softs have this). I don't know how it is coded in the core of Blender, but the acces to the weights through python isn't really friendly and slows down the script(I rewrite the weights in a table).
3)the functions for writing the weights should be changed(maybe direct acces to the table?) because the replace function is not able to assign vertices to a group, if the vertex isn't already in the group.
4)and, the weights should be normalized, as z3r0_d wrote.(I maybe add this to the script)

enjoy.

yeah and if the script is well tested, maybe somone with the commit rights could post it to the release.
But there's a bug i haven't found yet in the script- it simply sometimes doesn't work on a mesh, or on a specific group, i don't know why. If anybody realizes how this bug works, please post.
You can also correct my english in the script, I don't write english very well. And, of course, you can add new features to it :)

bfvietnam
Posts: 0
Joined: Wed Apr 21, 2004 8:54 pm

Yeah that's how it was done in kinemation

Post by bfvietnam »

In kinemation (old Alias/Wavefront package) they would assign vertices to bones, and each bone had a different color, the influence of one bone on another bone's skin vertices would be recognized by a blending of color between the bone colors.. And you could see the contriobution of all the bones all at the same time, but it was impossible to see the contribution of
of more than one bone, if you can imagine.. And having points also influenced by flexors (lattices) just made it harder to deal with..

JA-forreal
Posts: 0
Joined: Sat Mar 22, 2003 10:45 pm

Post by JA-forreal »

This is a great idea for a script pildanovak. Did you try posting on elysiun in the Blender Python & Plugins area?-

http://www.elysiun.com/forum/viewforum.php?f=5

You can post over there and also get great tips from other Blender coders.

Again, great script!

pildanovak
Posts: 18
Joined: Fri Oct 25, 2002 9:32 am
Contact:

update

Post by pildanovak »

the script is a little updated now, there's a new button for normalize- when on, all the vertices in the mesh are normalized while smoothing(so the colors show the real influence of the bone), and another button include, which means that the 2nd bone should be taken too, if restricted to groups.

The most simple way to make a perfect smooth transition is by now restrict to vertices, select the area and launch Smoothing several times.

the main problem by now is, that the mesh, after assigning the weights resets to the 1st group, and the displaying of the weights(but is better after normalize added)

pildanovak
Posts: 18
Joined: Fri Oct 25, 2002 9:32 am
Contact:

Post by pildanovak »

Has anybody tested this script?

The script is a little debugged now, and for me it works fine.

Could anybody with commit rights post it to the cvs?

kencanvey
Posts: 0
Joined: Mon Jun 02, 2003 7:54 am
Location: Smethwick West Midlands UK

Post by kencanvey »

Hi,

I dont get any errors when I alt-p this py,(bf blender 2.34 pre) but, I don't really know what it does :oops: , if you would let me know what it is for (assume I know nothing :D ) I would be more than willing to test it fully for you, as I have lots of free time.


Ken

pildanovak
Posts: 18
Joined: Fri Oct 25, 2002 9:32 am
Contact:

Post by pildanovak »

it smooths and normalizes the weights of vertex groups. so, if you have a mesh linked to an armature, and are assigning vertex groups, you can smooth transitions between them. this makes the deformation look better,and saves a lot of time of weight painting.

the normalization is explained in tooltip, it makes the sum of weights in 1 vertex 1.0, so if a vertex is red(in weight paint mode), you can be sure that the assigned bone has full controll of it etc. It shows the real influence of the bone(if you don't normalize, you see the weights assigned, but not the real influence).

Money_YaY!
Posts: 442
Joined: Wed Oct 23, 2002 2:47 pm

Post by Money_YaY! »

a little tutorial for all of the buttons and way to use it would be nice. I see how picking two different bones and pressing the button makes it have the colors change but what of the rest ?

pildanovak
Posts: 18
Joined: Fri Oct 25, 2002 9:32 am
Contact:

Post by pildanovak »

http://www.ffa.vutbr.cz/~novak/tutorial/index.htm

this is a terrible little tutorial for the script.

!!!!!Please, could anybody commit the script to the cvs?!!!!!
http://server.ffa.vutbr.cz/~novak/files ... tGroups.py


I've made it and debugged it before 2.34 release, and it wasn't in the release.
Why have i made such a nice UI, when nobody except me can use the script???!?!?!? :wink:

Caronte
Posts: 76
Joined: Wed Oct 16, 2002 12:53 am
Location: Valencia-Spain-Europe

Post by Caronte »

Your script is very usefull and is easy to use too!

Thanks!

P.D: If you can implement UnDo, this will be perfect :D
Caronte.
"Some Day, All Will Be Digital"
http://www.nicodigital.com

JA-forreal
Posts: 0
Joined: Sat Mar 22, 2003 10:45 pm

Post by JA-forreal »

Thanks pildanovak!

jm
Posts: 0
Joined: Mon Aug 25, 2003 11:31 am
Contact:

Post by jm »

script is moved to
http://plant.ffa.vutbr.cz/~novak/files/zipped/
this one is currently in ScriptPack

Post Reply