Animation baker
In this section, you will learn how to take an animation clip and encode it into an animation texture. This process is called baking.
Texture baking is implemented using a helper function that bakes the animation into a texture. This Bake
function will sample the animation at set intervals and write the skeleton hierarchy for each sample into a floating-point texture.
For arguments, the Bake
function needs a skeleton, an animation clip, and a reference to an AnimTexture
to write to. The skeleton is important as it provides the rest pose, which will be used for any joint that isn't present in the animation clip. Every joint of the skeleton will get baked into the texture. Let's get started:
- Create a new file called
AnimBaker.h
and add the declaration of theBakeAnimationToTexture
function to it:void BakeAnimationToTexture(Skeleton& skel, Clip& clip, ...