The purpose of AnimToTexture plugin
AnimTotexture plugin allows to create animated Static meshes that look and behave like Skeletal meshes. This is important especially in the sense of performance optimization, as unlike of static meshes, calculating and rendering animations for skeletal meshes is extremely performance heavy.
What does AnimTotexture plugin do?
AnimTotexture plugin basically takes a skeletal mesh, an equivalent static mesh, and a list of sequences and generates the textures with the weighting information, as well as the bone rotation and translation, and also prepares the material to be able to reproduce it.
Enabling AnimTotexture plugin
To enable AnimToTexture plugin In Unreal Engine 5.1 and above, go to Edit → Plugins, and on All Plugins list search for "AnimToTexture". Enable the found plugin and restart Unral Engine. After the relaunch, the AnimToTexture plugin content is located at All/Engine/Plugins/AnimtToTexture.
AnimTotexture plugin content
BP_AnimToTexture Editor Utility Widget shows an example of using AnimationToTexture node for creating Static Mesh with VertexAnimation and BoneAnimation. All it does is that it runs following function sequence on UtilityWidget Event Run.
As you can see, both methods differs by used DataAsset file and attached Material Instances. Actually, both Material Instances are quite identical, used separatelly in this case only to avoid overwriting as both methods (VertexAnimation and BoneAnimation) are processed at once. ..so long story short, the only difference is in configuration declared in the AnimTotexture DataAsset file.
In conclusion, as clear, if we would run the BP_AnimToTexture Editor Utility Widget attached in the plugin, there would be 2 main outputs - Static mesh with Bone Animation (SM_Mannequin_BoneAnimation) and with Vertex Animation (SM_Mannequin_VertexAnimation). By default, they are already a part of the plugin content. The same way may be used for any other Meshes.
AnimToTexture helpers plugin
AnimToTexture helpers plugin is a Utility Widget build above AnimToTexture plugin. The plugin is available for download at AnimToTextureHelpers Github Page and explained in its Forum introduction and on the video below:
- Fix of mentioned issue in the video: the “choppy” animations is coming from the texture format R8G8B8A8 instead of FloatRGBA. It can be resolved by ensuring that there's 16bit texture precision selected and the Force Power of Two option checked.
- In UE 5.2 and above, there's missing
Param names nodethat results in an error.
Anim To Texture DataAsset
Through to the AnimTotexture Data Asset, there's possible to configurate data for AnimTotexture plugin. There's possible to fill whole characters as well as their parts, as of example of loafers below:
Controlling AnimToTexture animations in runtime
Schema
AnimToTexture VAT definition
DataAssetfile ofAnimToTextureDataAssettypeThe file links to baked static mesh and keeps animation data for it, see the image below
MaterialLayer controlling animation
As ISM is static, all movements are driven through a material, see a sample of
ML_BoneAnimationat the image belowTake into notice following material parameters: FrameOffset- refers to frame on which the animation starts (Anim Startfrom VAT) -> For running animation with index 2, setFrameOffset= 588NumFrames- refers to length of animation (Num Framesfrom VAT)
Switching between animations in runtime
Setting ISM Vertex animation properties is possible through class
UMaterialInstanceDynamicUMaterialInstanceDynamic* DynamicMaterial = MeshComponent->CreateAndSetMaterialInstanceDynamic(0); if (DynamicMaterial) { DynamicMaterial->SetScalarParameterValue(FName("FrameOffset"), DesiredFrameOffset); DynamicMaterial->SetScalarParameterValue(FName("NumFrames"), DesiredNumFrames); DynamicMaterial->SetScalarParameterValue(FName("Playrate"), 1.0f); DynamicMaterial->SetScalarParameterValue(FName("bLooping"), 1.0f); // enable bLooping // ... }
Notes
- In
Unreal Engine 5.3, AnimToTexture plugin has onlyContentfolder, but it does not containSourceforlder with C++ source code.