Microsoft DirectX 9.0

Vertex Blend Sample


The Vertex Blend sample demonstrates a technique called vertex blending, also known as surface skinning. It displays a file-based object that is made to bend in various spots.

Vertex blending is used for creating effects such as smooth joints and bulging muscles in character animations.

Not all cards support all features for vertex blending. For more information about vertex blending, refer to the Microsoft?DirectX® software development kit (SDK) documentation.


Source: (SDK root)\Samples\C++\Direct3D\VertexBlend

Executable: (SDK root)\Samples\C++\Direct3D\Bin

User's Guide

The following table lists the keys that are implemented. You can use menu commands for the same controls.

ENTERStarts and stops the scene.
SPACEBARAdvances the scene by a small increment.
F2Prompts the user to select a new rendering device or display mode.
ALT+ENTERToggles between full-screen and windowed modes.
ESCExits the application.
CTRL+VSwitches between a custom vertex shader and Microsoft Direct3D?vertex blending.

Programming Notes

Vertex blending requires each vertex to have an associated blend weight. Multiple world transforms are set up using SetTransformState and the blend weights determine how much contribution each world matrix has when positioning each vertex.

In this sample, a mesh is loaded using the common helper code. Note how a custom vertex and a custom flexible vertex format (FVF) is declared and used to build the mesh; see the SetFVF call for the mesh object. Without using the mesh helper code, the technique is the same. Create a vertex buffer full of vertices that have a blend weight, and use the appropriate FVF.

This sample uses common DirectX code that consists of programming elements such as helper functions. This code is shared with other samples in the DirectX SDK. You can find the sample framework headers and source code in (SDK root)\DXSDK\Samples\C++\Common\Include and (SDK root)\DXSDK\Samples\C++\Common\Src.

© 2002 Microsoft Corporation. All rights reserved.