Microsoft DirectX 8.1 (Visual Basic)

VertexBlend Sample

Description

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 at various points. Surface skinning is an impressive technique used for effects such as smooth joints and bulging muscles in character animations.

Not all display cards support all features for vertex blending. For more information on vertex blending, see Indexed Vertex Blending.

Path

Source: (SDK root)\Samples\Multimedia\VBSamples\Direct3D\VertexBlend

Executable: (SDK root)\Samples\Multimedia\VBSamples\Direct3D\Bin

User's Guide

The following table lists the keys that are implemented.

Key Action
F2 Prompts you to select a new rendering device or display mode.
ALT+ENTER Toggles between full-screen and windowed modes.
ESC Exits the application.

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 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 Microsoft® DirectX® code that consists of programming elements such as helper functions. This code is shared with other samples on the DirectX SDK. You can find the common source code in (SDK root)\Samples\Multimedia\VBSamples.