Doing skeletal animations in compute shaders
Skeletal animations imply moving vertices based on the weighted influence of multiple matrices, which represent a skeleton of bones. Each bone is represented as a matrix that influences nearby vertices based on its weight. For instance, the hand bone would heavily influence hand vertices, while it would have no effect on foot vertices. Vertices near the wrist might be affected by both the hand and arm bones. In essence, skinning requires bones, a hierarchy of matrices, and weights.
Weights, like vertex colors, are assigned per vertex and range from 0
to 1
, indicating how much a specific bone influences that vertex’s position. These weights are stored in a buffer and passed as vertex attributes. In this recipe, we cover the final part of the animation player with skinning support.
In the recipe Importing skeleton and animation data, we learned how to load bone weights and hierarchy. Now, let’s look at how to use this...