In this tutorial repository and accompanying video you will learn how to bake animations as a series of "snapshots" of meshes. These snapshots can be taken at a configurable framerate that suits your game. The concept here is attacking a similar problem to Animation Instancing, but is still handled by the CPU and does not require any "shader magic" to manipulate the vertices. It also does not reduce the Draw Calls, as Animation Instancing will do. Instead, this attacks the "CPU Skinning" taking up a lot of CPU time on the main Unity thread to improve FPS.
This can be taken one step further to batch all the meshes into a single draw call per material via Graphics.DrawMeshInstanced(). Strangely, with my initial attempt, the performance was actually worse than what is implemented here. I didn't have time to dive into that and the performance here was "good enough" for my use case.
This tutorial was inspired by the codingwoodsman's implementation. Special thanks to him for getting my gears turning on this topic and helping my own game's performace with this technique.
Have you been getting value out of these tutorials? Do you believe in LlamAcademy's mission of helping everyone make their game dev dream become a reality? Consider becoming a Patreon supporter and get your name added to this list, as well as other cool perks. Head over to https://patreon.com/llamacademy to show your support.
- Andrew Bowen
- Andrew Allbright
- YOUR NAME HERE!
- YOUR NAME HERE!
- Gerald Anderson
- AudemKay
- Matt Parkin
- Ivan
- Reulan
- YOUR NAME HERE!
- Bastian
- Trey Briggs
- Matt Sponholz
- Dr Bash
- Tarik
- EJ
- Chris B.
- Sean
- YOUR NAME HERE!
Interested in other AI Topics in Unity, or other tutorials on Unity in general?
- Requires Unity 2021.3 LTS or higher.