Vertex animation: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
(bone driver is optional)
Line 5: Line 5:
== Implementation ==
== Implementation ==


# Add a bone which will "host" the vertex animation.
# Create a vertex animation in your modelling tool.
# Create a vertex animation in your modelling tool.
# Export a Vertex Cache file. Currently only the official Maya exporter can do this, and only to SMD.
# Export a Vertex Cache file. Currently only the official Maya exporter can do this, and only to SMD.
# Add the <code>vcafile</code> command to your [[$model (QC)|$model]] block (see example below).
# Add the <code>vcafile</code> command to your [[$model (QC)|$model]] block (see example below).
# Add two <code>[[$boneflexdriver]]</code> commands to bind your animation to your host bone (see example).
 
# Add at least one <code>[[$sequence]]</code> in which the flex host bone is animated in the X and Y axes. Its X position defines the blend weight of the vertex animation (0-1), and its Y position defines the frame of vertex animation (0-1).
This produces two flex controllers named after your VCA file. The first defines the blend weight of the animation, the second (prefixed with <code>multi_</code>) defines the active frame.
 
A programmer can now control your animation. If you need to map the vertex animation to a standard animation sequence, perform these extra steps:
 
# Add a new bone which will drive the vertex animation. It doesn't need to have any vertices attached.
# Add two <code>[[$boneflexdriver]]</code> commands to bind your animation to the new bone (see example).
# Add at least one <code>[[$sequence]]</code> in which the new bone is animated in its X and Y axes. Its X position defines the blend weight of the vertex animation (0-1), and its Y position defines the frame of vertex animation (0-1).


== Example ==
== Example ==
Line 18: Line 23:
vcafile "vertex_animation.vta"
vcafile "vertex_animation.vta"
}
}
// Optional:


$boneflexdriver "flexAnimBone" tx "vertex_animation" 0 1
$boneflexdriver "flexAnimBone" tx "vertex_animation" 0 1

Revision as of 10:18, 5 May 2014

Vertex animation is the keyframed animation of individual vertices of a mesh. It's good for very complicated motion like that of cloth, hair, or water. It should not be confused with flex animation, which deforms a mesh from one shape to another by moving its vertices in straight lines.

Vertex animation was added in Source Filmmaker and is also available in Dota 2.

Implementation

  1. Create a vertex animation in your modelling tool.
  2. Export a Vertex Cache file. Currently only the official Maya exporter can do this, and only to SMD.
  3. Add the vcafile command to your $model block (see example below).

This produces two flex controllers named after your VCA file. The first defines the blend weight of the animation, the second (prefixed with multi_) defines the active frame.

A programmer can now control your animation. If you need to map the vertex animation to a standard animation sequence, perform these extra steps:

  1. Add a new bone which will drive the vertex animation. It doesn't need to have any vertices attached.
  2. Add two $boneflexdriver commands to bind your animation to the new bone (see example).
  3. Add at least one $sequence in which the new bone is animated in its X and Y axes. Its X position defines the blend weight of the vertex animation (0-1), and its Y position defines the frame of vertex animation (0-1).

Example

$model "body" "ref_mesh.smd" {
	vcafile "vertex_animation.vta"
}

// Optional:

$boneflexdriver "flexAnimBone" tx "vertex_animation" 0 1
$boneflexdriver "flexAnimBone" ty "multi_vertex_animation" 0 1

$sequence "vertex_animation" "flexAnimBone_anim.smd"

See also