Wrinkle maps: Difference between revisions
(Clearer image) |
(clarifications) |
||
Line 1: | Line 1: | ||
[[File:Wrinkle mapping.jpg|thumb|Wrinkle maps add fine detail to the forehead.]] | [[File:Wrinkle mapping.jpg|thumb|Wrinkle maps add fine detail to the forehead.]] | ||
'''Wrinkle maps''' are a component of [[DMX model|DMX]] [[Flex animation|flex shapes]] | '''Wrinkle maps''' are a component of [[DMX model|DMX]] [[Flex animation|flex shapes]] used by the <code>[[VertexLitGeneric]]</code> 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. | 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. | ||
Line 7: | Line 7: | ||
== Generation == | == Generation == | ||
Wrinkle maps are generated programmatically. 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. | 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. | * Positive wrinkle scales lead to the compress texture being applied. | ||
Line 40: | Line 40: | ||
[[File:Valve_l4d2_wrinkle.png|thumb|A <code>$compress</code> texture from [[Left 4 Dead 2]].]] | [[File:Valve_l4d2_wrinkle.png|thumb|A <code>$compress</code> texture from [[Left 4 Dead 2]].]] | ||
Implementing wrinkle maps requires a <code>[[VertexLitGeneric]]</code> material with <code>[[$phong]]</code> enabled. | |||
There are four shader parameters | There are four shader parameters involved: | ||
; <code>$compress</code> | ; <code>$compress</code> |
Revision as of 11:43, 7 November 2013
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.
Generation
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.
dmxedit
The official SDK tool for creating wrinkle maps is dmxedit
. It is run on an exported DMX using a simple Lua script like this:
Load("C:/heavy_morphs_high.dmx")
SetWrinkleScale("BrowInV", "WrinkleNose", -0.5) -- controller name, shape name, scale
SetWrinkleScale("BrowInV", "RaiseBrowIn", 2)
-- etc.
ComputeWrinkles()
Save("C:/heavy_morphs_high.dmx")
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.
Materials and textures
Implementing wrinkle maps requires a VertexLitGeneric
material with $phong
enabled.
There are four shader parameters involved: