The vertex animation package is a solution with the goal of having thousands of units on screen at the same time, each one controlled by its own animation state.
Project Details
I worked on this project while I was part of the Tech Art Outsource team. This tool was build for project Castle, it’s a game where thousands of units are on the screen at the same time. To render all of these on screen they needed an effective solution. This project was already using Unity DOTS, so this was the perfect opportunity to get started with this and utilize the “performance by default” technology.
Engine | Unity (C#, HLSL) |
Prototype Time | 2 Week |
Development Time | 7 Weeks |
Team | 1 Tech Artist 1 Programmer |
Client | Project Castle |
Features
- Vertex animation model baker
- Multiple animations (stored in one Texture2DArray)
- LOD generation
- Prefab generation
- Animation book generation
- DOTS animation system
- Simple API
- Animation library and books
- Shaders
- Lit vertex animation shader
- Interpolation
- Normal encoding and decoding
- Shader graph support
Model Baker
Artist friendly GUI for converting models.
DOTS Animation System
Sample code to play an animation.
protected override void OnUpdate()
{
float deltaTime = UnityEngine.Time.deltaTime;
Entities.ForEach((Entity entity, ref VA_AnimatorComponent ac) =>
{
// Get the animation lib data.
ref VA_AnimationLibraryData animationsRef = ref ac.animationLibrary.Value;
// Set the animation index on the AnimatorComponent to play this animation.
ac.animationIndex = VA_AnimationLibraryUtils.GetAnimation(ref animationsRef, animationName);
// 'Play' the actual animation.
ac.animationTime += deltaTime * animationsRef.animations[ac.animationIndex].frameTime;
}).ScheduleParallel();
}
Shaders
Lit example shader (build in shader graph).
Full shader graph support.