The home of Barnaby Smith

XNA Morph Targets

February 2nd, 2011 | Posted by mvi in XNA


I’ve uploaded an example implementation of morph targets on the GPU. This example uses multiple vertex streams and blends between them using a vertex shader. This approach is a differing method to CPU or VTF based implementations and does not require the calculation of vertex textures, making it quite simple and straightforward. I believe the performance should be better than the usage of VTF, but this would need profiling to prove. Because of the nature of the implementation each morph target must have the same topology (vertex/index count and ordering.) Now from my experience this should be fine as long as you start with the same base mesh, although I’ve seen comments saying that topology can change when the model is built by the content importer (but I’ve never seen that myself.) The video above is an old version, the newer one cycles through multiple morph targets rather than just two. I’ve spent some time commenting the source code so it should be quite explanatory.

This has been implemented in XNA 3.1, it shouldn’t take too long to port to XNA 4 (this cheatsheet may be of some assistance.)

Download here

You can follow any responses to this entry through the RSS 2.0 Both comments and pings are currently closed.

One Response