Microsoft DirectX 8.1 (C++) |
The VertexBlend 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 on vertex blending, refer to the Microsoft® DirectX® SDK documentation.
Source: (SDK root)\Samples\Multimedia\Direct3D\VertexBlend
Executable: (SDK root)\Samples\Multimedia\Direct3D\Bin
The following table lists the keys that are implemented. You can use menu commands for the same controls.
Key | Action |
---|---|
ENTER | Starts and stops the scene. |
SPACEBAR | Advances the scene by a small increment. |
F2 | Prompts the user to select a new rendering device or display mode. |
ALT+ENTER | Toggles between full-screen and windowed modes. |
ESC | Exits the application. |
CTRL-V | Switches between a custom vertex shader and Direct3D vertex blending. |
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 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 programming elements such as helper functions. This code is shared with other samples in the DirectX SDK. You can find the common headers and source code in (SDK root)\Samples\Multimedia\Common.