Member-only story
Dev Diary — Skeletal Animation and GPU Skinning
frustrating start, orgasmic result

I got bored of working on my toy renderer. So I decided to switch it up a bit and work on some other typical systems of a game engine. And then out of nowhere, skeletal animation hit my mind. “yeah… why not?! How hard can it be? You got a mesh and some bones. You accumulate bone transforms. You tick and interpolate the animation keyframes…” Before I knew it, I was 30 hours deep in the rabbit hole, about to pull my hair out staring at a deformed humanoid mesh flapping its leg around all over the place.
The Skeleton
The first couple nights of this adventure, I had some random TV shows playing in the background. Everything was still chill. Then I realize after days I still couldn’t even wrap my head around getting all the data I needed to set up the bone structure correctly. To be fair, the node graph and bone data relationship in Assimp is confusing as fuck. Anyways, here are the things we need:
- Transform and Inverse Bind Pose(OffsetMatrix) of each bone (passed as uniform)
- Bound bones (IDs/indices and weights) of each vertex (stored as vertex attribute)

The Math
The goal of skeletal animation system, is to animate/move the “skin” (mesh made of vertices) “along” with the bound bones and deform accordingly. What’s stored in the animation key frames, are the local transformation of the specific bone in model space. So in order get a model transform of a child bone, we need to chain/recursively multiply all the local transformation of its parent bones. So now we can get the model space transformation of any bone.
But the bones by default are all positioned in the default bind pose of the skeleton (usually a T-Pose). How do we calculate the transformation needed to transform a bone from default bind pose to animated pose?
(I remember I was asked this exact question during a interview for frostbite)