Vertex Weight / Skinning Calculations - GPU or CPU?

Started by
9 comments, last by newObjekt 11 years, 1 month ago

What keeps you from doing exactly the same in the shader? And don't tell me you're using the fixed function pipeline, I'm out then.

To stay in your terms: you usually combine the bone's bind transformation (the original position and rotation) in relation to the mesh, plus the current rotation offset and position offset, all into one transformation matrix. You end up with an array of matrices which you upload to the shader. You enhance your vertex structure to contain a number of bone indices (normally 4, because the fit nicely into an input register) and an equal count of weights that specify how much the vertex is influenced by that bone. So every vertex in your mesh says: I'm affected by bone 13, 25 and 5, with a weight of 0.3, 0.25 and 0.45, respectively. The shader now simply transforms the vertex by each bone matrix, accumulating the result weighted by the corresponding vertex weight, and you're done.

Yeah this is basically what I read about but I could find any explanation on how to do it in code.

This topic is closed to new replies.

Advertisement