Click or drag to resize
DigitalRuneMorph Targets

A mesh may include morph targets, which can be imported using the content pipeline.

This topic contains the following sections:

Morph targets

A morph target is variation of the base mesh. Morph targets are typically used for facial animation. The base mesh defines the neutral expression and the morph targets define expression such as "smile", "frown", "eyes closed", etc. The base mesh and the morph targets need to have the same structure, i.e. the same number of vertices stored in the same order. At runtime the renderer can interpolate (mix) base mesh and morph targets to create complex facial animations. Other uses of morph targets include "corrective shapes", "damage states", etc.

Most modeling tools support morph targets (also called "blend shapes" or "shape keys"). Certain model formats, such as FBX, can store morph targets directly. However, the standard XNA model importer cannot import these elements directly.

Morph targets need to be exported as regular meshes which are linked ("parented") to the base mesh.

In addition the morph targets need to be called "MORPH_name" where name is the name of the morph target at runtime. (The prefix "MORPH_" will be automatically removed by the model processor.)

The following patterns are also supported: "name_MORPH", "MORPHTARGET_name", "name_MORPHTARGET", "BLENDSHAPE_name", "name_BLENDSHAPE".

Example

The following model is used in the FacialAnimationSample.

Model with morph targets
Figure: Model with morph targets

The model on the top left is the base mesh. The remaining models are morph targets, which are linked ("parented") to the base mesh. The morph targets are called: "MORPH_EYE-closed", "MORPH_MOUTH-smile", "MORPH_MOUTH-e", ...

At runtime the morph targets can be access as "EYE-closed", "MOUTH-smile", "MOUTH-e", ...

For example:

Activate a morph target
// Show the morph target named "MOUTH-smile".
meshNode.MorphWeights["MOUTH-smile"] = 1.0f;