Vertex skinning artifacts with specific glTF models

  artifacts, c++, point, skinning, vertex

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);

Source: Windows Questions C++

LEAVE A COMMENT