Notifications
Clear all

[Closed] Set Skin Weights

 MZ1

How we can set skin weight for a vertex depend on it’s world position? Note that my object is a non-mesh object.

5 Replies

is it a geometry at least?

OK. just use it’s mesh and multiply mesh vertex position by your object’s transform. it will make the world position.

after that apply skin weight the same way as for any other object (using its skin modifier). anything else?

the question is how to map “world position” to “weight” … it needs float value. maybe height or distance to the world origin.

 MZ1

Thank you Denis, my first question is how we can get vertex position on geometry?

as i answered above… lets say we have a box:

delete objects

b = box()
b.transform = translate (rotate (scalematrix [2,2,2]) (eulerangles 45 45 45)) [10,0,0]  
	
-- verteces world pos:
for v=1 to 8 do
(
	p = (getvert b.mesh v) * b.transform	
	point pos:p wirecolor:red
)

if you have to check many vertices it’s better to snapshot the geometry mesh first which gives you the mesh in current object state in world coordinate system:

delete objects

b = box()
b.transform = translate (rotate (scalematrix [2,2,2]) (eulerangles 45 45 45)) [10,0,0]  
	
-- verteces world pos:
m = snapshotasmesh b 
for v=1 to 8 do
(
	p = getvert m v	
	point pos:p wirecolor:green
) 

and delete this mesh after to free the memory used

free m
-- or 
delete m
 MZ1

I completely forget .mesh property, I have another questions about skinning process:

1 – We have to activate modify stack for almost all “skinops” functions. why we had to do this?
2 – Let say we know specific node as a bone, how we can get it’s Index?
3 – I just realized some functions inside skinops are not documented like SelectBoneByNode or blendSelected.
4 – in general what is the best and fastest way to set skin weights?
5 – SetVertexWeights doesn’t works very well, but ReplaceVertexWeights works, what is difference?