1

I recently implemented vertex skinning in my own Vulkan engine. Pretty much all models render properly, however, I find that with Mixamo models, I get skinning artifacts. The main difference I found between "regular" glTF models and Mixamo models, is that the Mixamo models share inverse bind matrices between multiple meshes, but I highly doubt that this causes this issue.

Text

Here you can see that for some reason the vertices are pulled towards one specific point which seems to be at (0, 0, 0). I know for sure that this is not caused by the vertex and index loading, as the model renders properly without vertex skinning.

Calculation of joint matrices

void Object::updateJointsByNode(Node *node) { if (node->mesh && node->skinIndex > -1) { auto inverseTransform = glm::inverse(node->getLocalMatrix()); auto skin = this->skinLookup[node->skinIndex]; auto numberOfJoints = skin->jointsIndices.size(); std::vector<glm::mat4> jointMatrices(numberOfJoints); for (size_t i = 0; i < numberOfJoints; i++) { jointMatrices[i] = this->getNodeByIndex(skin->jointsIndices[i])->getLocalMatrix() * skin->inverseBindMatrices[i]; jointMatrices[i] = inverseTransform * jointMatrices[i]; } this->inverseBindMatrices = jointMatrices; } for (auto &child : node->children) { this->updateJointsByNode(child); } } 

Calculation of vertex displacement in GLSL Vertex Shader

 mat4 skinMat = inWeight0.x * model.jointMatrix[int(inJoint0.x)] + inWeight0.y * model.jointMatrix[int(inJoint0.y)] + inWeight0.z * model.jointMatrix[int(inJoint0.z)] + inWeight0.w * model.jointMatrix[int(inJoint0.w)]; localPosition = model.model * model.local * skinMat * vec4(inPosition, 1.0); 
4
  • Are any of the matrices ill conditioned? Commented Feb 4, 2021 at 21:20
  • Thanks for your comment! I have tried to set both the jointMatrix to an identity matrix and the vertex weight to 0.25 (since they should add up to 1 and they contain 4 components). And the same problem occurs there. So if there would be ill-conditioned matrices, this problem is most likely not caused by them.. Commented Feb 4, 2021 at 21:31
  • Do you have hard coded limits for the max. number of joints? If so, then that specific model may have a joint count above that limit, which may cause such artifacts. Commented Feb 6, 2021 at 9:01
  • I do, I have set it to 256, but this model only has 67 joints. Commented Feb 6, 2021 at 15:03

1 Answer 1

0

So basically the mistake I made was relatively simple. It was caused by casting the joints to the wrong type. When a glTF model uses a byte stride of size 4 for the vertex joints, the implicit type is uint8_t (unsigned byte) and not the uint16_t (unsigned short) which I was using.

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.