# GPU baking animation
When dealing with some simple and massive animations (such as mobs, scene objects), in order to save CPU resources to the greatest extent, the animation system of the mini game framework provides GPU baking animation support.
# Use existing animation prefabs for baking
Select the Prefab of the character animation in the Project panel (from fbx extraction or import from a third-party engine), right click -> bake the prefab animation body to the GPU
Fill in the path where the baking resources are stored. In the case, create a Baked
subdirectory under the same level directory. Click OK, you can see the generated prefab in the Baked directory, and each animation clip generates a dataimage to store the corresponding baked animation data
# Add the baked animation to the scene
Add the generated prefab to the scene, you can see that it contains a SkinnedAnimationRenderer
component, and the initial default action is TPose.
Change the initial action to the target action, and you can see the effect in preview.
# GPU baking animation limitations
Although GPU baking can effectively reduce the CPU load of animation to free up more time slices for business logic, there are some restrictions on its use. Therefore, it is recommended to use it selectively in combination with specific business scenarios.
The following are the considerations for using GPU to bake animations:
- The animation blending function is not available
- The load on the GPU vertex shader will increase, which is reflected in the increased sampling load
- Animation clips cannot be reused. Even if two models use the same animation clip, two copies of baked data will be generated. So some situations may cause the amount of resources to increase