Wrinkle maps

From Valve Developer Community
Revision as of 18:02, 11 February 2015 by Shawnolson (talk | contribs)
Jump to: navigation, search
Wrinkle maps add fine detail to the forehead.

Wrinkle maps are a component of DMX flex shapes used by the VertexLitGeneric shader to make per-vertex texture changes when the flex shape is applied. They are typically used to add fine wrinkling detail to a character's skin.

The term "wrinkle map" is confusing, because it can refer to the act of adding or removing wrinkles. The terms "compress" and "stretch" are used to refer to these two effects.


Wrinkle maps are generated programmatically before a model is compiled. The important value is the wrinkle "scale", which defines the upper limit of wrinkling. A scale of 1 means that only the vert which moves the furthest is fully wrinkled; a scale of 2 means that the top 50% of moving verts are fully wrinkled.

  • Positive wrinkle scales lead to the compress texture being applied.
  • Negative wrinkle scales lead to the stretch texture being applied.

It isn't possible for a single shape to both stretch and compress; if that effect is needed, make a flex controller which wraps multiple shapes.


The official SDK tool for creating wrinkle maps is dmxedit. It is run on an exported DMX using a simple Lua script like this:


SetWrinkleScale("BrowInV", "WrinkleNose", -0.5) -- controller name, shape name, scale
SetWrinkleScale("BrowInV", "RaiseBrowIn", 2)
-- etc.



If you are using Source Filmmaker you will find a collection of helper files at SourceFilmmaker\game\sdktools\lua\. These can be used to set up your model in the same way as Valve's.

Blender SMD Tools

The Blender SMD Tools can generate wrinkle maps when exporting your model. Enable Advanced flex mode, generate a flex controller block, and set a non-zero wrinkleScales value in the relevant flex controller definitions.

Wall Worm Model Tools

Wall Worm Model Tools can now export wrinkle maps. Simply add a Vertex Paint Modifier to any morph target and name it "wrinkle". Paint the wrinkle weights into that vertex paint. Black is full compress. White is full stretch. Gray is no stretch or compress.

Materials and textures

A $compress texture from Left 4 Dead 2.

Implementing wrinkle maps requires a VertexLitGeneric material with $phong enabled.

There are four shader parameters involved:

Path to textures which are applied when a flex controller compresses or stretches the mesh.
Optional bump map textures for $compress and $stretch.