From Valve Developer Community
Jump to: navigation, search

Enveloping is the process of attaching a model's Mesh vertices to the appropriate Bones in its Skeleton. When the skeleton articulates, the envelope's vertices will move with it, and the polygons will stretch or compress around joints. The Weightmap defines the relative amount of stretch for each vertex.

Tip.png Tip: Don't confuse weightmaps with $weightlists.


Quick start
For a Rigid model the model editor's SMD exporter should create a rootbone and envelope your mesh to it automatically. If you need to realign the mesh's Position in relation to its placementOrigin, this can be done in QC; see $autocenter.
Editable data
The envelope and weightmap data is configured in a model editor and exported to the mesh's SMD triangles block.
Every vertex in the mesh must be assigned to a specific Parentbone. The bone's index is used rather than its name, so if there is only one bone the parentbone is always "node 0".
For models with a jointed skeleton, each part of the mesh (a group of vertices) needs to be "parented" to the relevant bone. A given vertex can be attached to more than one bone, in which case the Weightmap data is used to "blend" the vertex's position relative to both bone positions. Jointed collision model convex hulls must not be enveloped to more than one bone, and so don't need any weightmap configuration data.
Sub-models (eg w_weapons) and Sub-meshes must be enveloped to the skeleton of their parent model to ensure that they align, move and deform correctly. This is usually done using the Bonemerge method (see Creating worldmodels from viewmodels).