View Full Version : Skinning

02-19-2011, 04:25 PM
How to make skinning when there are more than 4 bones per vertex?

Alfonse Reinheart
02-19-2011, 04:44 PM
Use more than 2 vec4 vertex attributes for your bone weights and indices.

Though really, there's little actual need. If during the processing of the mesh, you simply remove all the smallest weights beyond the limit of four (per-vertex), I'll bet that your modelers will never even notice you did it.

03-10-2011, 10:09 AM
I understand, but I am dissatisfied with a moment that if in my mesh there are a maximum number of weights by 2, I must add in each vertex 2 or more zero floats.
I have two attribute buffers: one is numbers of bone matrices and one for weights.
It is a good and simple method, but may be somebody know another one ?

Ilian Dinev
03-10-2011, 06:08 PM
If storage requirements are your problem, then use this feature:
if at glVertexAttribPointer you specify size=2 instead of 4, the attribute will be vec4(x,y,0,1). The {0,1} are auto-filled for you. If you have 3 weights, specify vec3(weight1,weight2,weight3). If you have 4 weights, specify vec4(weight1,weight2,weight3,1.0-weight4). In the shader, auto-fix the .w component.

Still, imho shoving/compressing everything into 2*4 unsigned bytes instead of 2*4 floats - is enough. Artists don't have really precise control over weight values, and bonesCount>256 isn't common.