VAT Shader Basics
Last updated
Last updated
A VAT (Vertex Animation Texture) is a shader and texture map combo technique used in 3D graphics to achieve efficient vertex animation without the use of bones its really useful for complex or deformable objects and otherwise animations that would require too many bones to be efficient.
The VAT shader requires access to the objects source file in order to create the required textures, compared to the Displacement shader where its possible to create maps that can work by understanding the UV layout of an asset
NOTES:
VAT is only able to change the appearance of the visual mesh and not collision.
Sansar vats are done differently to other external engines, for most users a tool has been created available below, for advanced users see VAT Technical Info for more.
The VAT shader requires the creator to have access to the object's source file to generate the necessary textures, as it relies on a secondary UV map to control animation. In contrast, the Displacement shader can work with maps created by understanding the UV layout of an asset, even without access to the source file. The advantage of the VAT shader is that its color maps are separate from the animation maps.
VAT maps are not considered human editable unlike basic displacement maps while it is possible its not something easy to do.
A Blender addon has been created to assist in making VAT assets. CLICK HERE to get the free tool for blender 3.4 and above, the tool is untested on previous versions.
After downloading the latest release of the tool, install into blender like any other addon. (User Preferences -> Addons -> Install from file) then select the .Zip file.
Once installed you should see the Sansar Tools addon on the sidebar.
Frame range: Selection of frame range for export by specifying first and last frame as well as frame step size. The lower the step size the more frames of animation will be captured. Sansar does have some interpolation between frames
Generate mesh: If checked, the mesh to be uploaded to sansar is generated together with the displacement and normal map. If unchecked, only the textures are generated.
Encode Map as Z-Curve: If checked, the generated images store the data in z-order (Morton Code), which is optimized for caching inside Sansar. In addition, the first pixel is used as a header encoding the number of vertices and the number frames. This option is required for generating Sansar assets. If disabled, the images store the data such that the vertices are the columns and the frames as rows of the images and is possible to use in other engines.
Export files: Export both images and the mesh (if generated) in the specified export path and filename prefix.
This is a basic guide on creating VAT assets. The blender tool converts keyframed animation from blender into a usable mesh and texture sets for SansarVAT. All objects will be combined into a single mesh with the tool, so make sure your individual objects are scaled and transforms applied.
The Blender tool needs keyframes of animation in order to convert into useable files.
Animate your object using any method you wish to create keyframes, this can be done with shape keys, bones, vertex based animation (enable the animAll addon in blender), and object animation +more.
Once you have all the keyframes required, select the desired objects, set you frame Start, End, and step rate in the Sansar addon
Choose the export path and the filename you wish your object to be called and hit the process button, the Sansar tool will create a export file of the mesh and the textures that you will then use to import into Sansar, it will also generate a new mesh for you along side your original object as a single combined mesh, this is the object you can export if not done for you.
You MUST use the generated mesh as your import model as it has been setup to adhear to SansarVAT for you.
In Sansar you can now import the object VAT files and setup the shader, using the two maps given, the VatMap and VatNormals add them to the required slots, you will need to choose the step rate you require to see the animation within the editor.
Add you other material maps like albedo, roughness etc and hit save.
Some animations are not keyframed in a way the tool can use, things like cloth simulations, and other various ways to create animated objects, there is a workaround for converting these non supported types by utilizing Point cache .mdd import and export.
Additionally the blender 'bake to keyframes' modifier may also help you create the needed keyframes.
Make sure your scale, location and rotation are applied on the object. (ctrl-A)
In user pref, add-ons, type ‘light’ and enable ‘import:export Lightwave Objects’ (check the checkbox)
Then type ‘new’ and enable ‘import:export NewTek mdd format
Save your prefs.
With your object selected, choose File-Export-Lightwave point cache (mdd) Give it a filename you can find.
Delete any modifiers that are not supported i.e Cloth-Sim in physics.
With the object still selected, choose File-Import-'Lightwave point cache (mdd) . Choose the .mdd file you saved.
The Object is now keyframed, with a shapekey on every single frame. The tool should now be able to convert these shapekey'd keyframes into a useable mesh.