Awesome
VatBaker
A tool to bake VAT (Vertex Animation Texture) from AnimationClip with sample shaders for Unity.
Installation
Edit > ProjectSettings... > Package Manager > Scoped Registries
Enter the following and click the Save button.
"name": "fuqunaga",
"url": "https://registry.npmjs.com",
"scopes": [ "ga.fuquna" ]
Window > Package Manager
Select MyRegistries
in Packages:
Select VatBaker
and click the Install button
Usage
- Window > VatBaker
- Set a GamObject with Animation and SkinnedMeshRenderer.
- (Optional) Set other parameters.
- Push the Bake button.
- Assets are created under
Assets/VatBakerOutput
and a VAT GameObject is put in the hierarchy.
Use VAT on your shader
Use VAT functions at the vertex shader.
#include `Packages/ga.fuquna.vatbaker/Shader/vat.hlsl`
vertex shader
float animationTime = CalcVatAnimationTime(<baseTime[sec]>);
float vertexPositionLocal = GetVatPosition(vertexId, animationTime);
float vertexNormalLocal = GetVatNormal(vertexId, animationTime);
See VatUnlit.shader, VatSurfaceStandard.shader
Set material properties for VAT.
Property name | Value |
---|---|
_VatPositionTex | Assets/VatBakderOutput/*/*.posTex.asset |
_VatNormalTex | Assets/VatBakderOutput/*/*.normTex.asset |
_VatAnimFps | Baked animation fps |
_VatAnimLength | Baked animation length[sec] |
It is recommended to duplicate the material under Assets/VatBakerOutput and change the shader so that the original property values can be used as they are.
Example Asset
- Rhino Animation Walk © GremorySaiyan (Licensed under CC BY 4.0)