Collada plugin for After Effects

More info here
Plugins and Scripts > trueSpace > Import/Export

Vertex Animation Texture Export for trueSpace7.61

Take a morph animation and export it as a vertex animation texture file for use in the vertex shaders found in game engines like Godot and Unreal.

vertex texture anim panel

Usage:

  1. Animate a mesh using vertex morphs.
  2. load the Vertex Texture Animation node into the link editor
  3. Select the mesh and set the play range of the animation in the anim view.
  4. Type a texture name, the file names will be TAV_name.png and TAN_name.png. Where TAV is the vertex position and TAN is the normals.
  5. Leave Relative Motion checked
  6. Press start and choose the folder for the files.
  7. The texture files will be generated and saved and the mesh UV2 will be setup to use the textures.
  8. Set the object morph to match the first frame of the animation.
  9. Copy the object and manually remove all the vertex morph nodes from the original object
  10. export the "Input Mesh" connector from the editable shape
  11. connect then disconnect the "Mesh" connector from the copy to the "Input Mesh" of the original to copy the morph state of the first frame
  12. export the mesh to a format the desired game engine can read
  13. use the values for scale, num frames, and offsets in the custom vertex shader
you tube here

TODO

  • test normals in UE4 - not needed in Godot, only 2 uvs allowed so no lighting?
  • "real" shader for UE4

Cloth Conversion utility can be used to export a cloth animation as a vertex color animation.

Future changes?

  • work with skeletal animations
  • work with physics

Theory

First the script makes a special uv layout in uv2 with the uv coordinates centered on the bitmap first row of pixels representing the first frame of the animation. Then the script finds the mesh vertex with the most amount of motion and uses that value as the maximum value of the bitmap for scaling the arbitrary xyz values into all positive rgb color values between 0 and 1. Then it runs through the animation to read the positions of all the vertices at each frame, saving the difference between the original position and the current xyz values. The scaled and offset difference is stored rgb values in the texture with 1 row for each animation frame and column size equal to the number of vertices in the mesh.

The mesh with the custom uv2 and textures are imported to software that supports vertex animations based on textures. A custom shader is created that moves the uv2 coordinate values through the texture, 1 row of pixels(1 frame) at a time reading the rgb values and converting them back into xyz values and adding them to the original xyz position in the vertex shader.

Notes:

  • might work with the cloth to morph tool clothvertexmorph
  • tested in Godot and UE4
  • relative motion gives better results and works in UE4
  • uv1 for color, uv2 created for vertex animation
  • tS can generate an unsigned floating point hdr format texture - negative values ignored by godot, UE4 wont import hdr as texture only as cube texture, in test converted to exr but the negative values may have been lost in conversion.
  • tS can load 16bit png but will not write 16bit png
  • tS does not have tex2Dlod shader function used to read texture samples for vertex shaders, so it cannot use animated vertex textures internally

Godot

  • Godot Visual Shader - right click to save as
  • Time Scale - speed of playback
  • Num Frames - number of animation frames exported, y size of the texture
  • Scale - multiplier to convert rgb 0-1 value back to xyz values
  • Offset - xyz offsets to recenter the mesh in it's local space - rgb 0-1 => +- xyz
  • Position - TAV texture
  • Albedo - mesh color texture
  • importing mesh as collada - newer formats better?
  • only 2 uv channels allowed so lighting needs to be baked into the color? texture or use unlit? need to learn more godot
  • texture import Compress=Lossless or Uncompressed
  • texture import Filter=Off
  • texture import Mipmaps=Off
  • shader flag unshaded?
  • Normals - TAN texture not used

UE4

  • import as fbx mesh
  • shader connections shown above work for quick preview - no scale or offsets or discrete frames
October 24, 2021
June 5, 2013