Skinning

How to make skinning when there are more than 4 bones per vertex?

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.

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 ?

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 24 unsigned bytes instead of 24 floats - is enough. Artists don’t have really precise control over weight values, and bonesCount>256 isn’t common.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.