Wrinkle maps: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
(rewritten with details on generation)
Line 1: Line 1:
[[Image:Valve_l4d2_wrinkle.png|thumb|200px|Coach's wrinklemap from Left4Dead2.]]
[[File:Wrinklemaps_src_small.png|thumb|Wrinkle maps add fine detail to the forehead.]]


WrinkleMaps are texture maps that accompany wrinkles in low polygon models for games. Since there is a limit to the amount of polygons a model can be for game engines artists bake out these so called wrinklemaps from the high polygon meshes and utilize them in the engine to produce the same render as if it was a high polygon model. This same concept is also done with normalmaps and is very useful in game engines.
'''Wrinkle maps''' are a component of [[DMX model|DMX]] [[Flex animation|flex shapes]] which make per-vertex changes to a model's [[texture]] when the flex is applied. They are typically used to add fine wrinkling detail to a character's skin.
Source has no documentation of wrinklemaps so I have decided to write this article to help other people understand the concept and learn how to go about producing them for Source.


{{note|WrinkleMaps can only work with models that get compiled from .dmx files.}}
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.
{{note|Need to wait for the Character Creation toolkit for Maya}}


== Generation ==


== The WrinkleMap diference ==
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.


Here is a picture showing the difference of utilizing this feature.
* Positive wrinkle scales lead to the compress texture being applied.
[[Image:Wrinklemaps_src_small.png|centre|900px]]
* Negative wrinkle scales lead to the stretch texture being applied.
As you can see in the left picture the creases on his left cheek and forehead as apposed to the one without wrinkles.


== Textures ==
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.
Wrinklemaps in Source work with two different textures you can examples inside the [[Left 4 Dead]] files located at <code>L4D root/materials/models/survivors/coach/</code>
[[Image:Diffuse_on.png|centre|300px]]
[[Image:Normal_on.png|centre|300px]]


=== dmxedit ===


== Using WrinkleMaps ==
The official SDK tool for creating wrinkle maps is <code>[[dmxedit]]</code>. It is run on an exported DMX using a simple [[w:Lua|Lua]] script like this:


=== Example VMT Syntax ===
<source lang=lua>
The following example is taken from one of the characters that will be shown in [http://alleyproject.net AlleyProject]
Load("C:/heavy_morphs_high.dmx")
<pre>
"vertexlitgeneric"
{
"$compress" "models/cra0kalo/kovic/Kovic_compress"
"$stretch" "models/cra0kalo/kovic/Kovic_stretch"
"$bumpcompress" "models/cra0kalo/kovic/Kovic_normal_compress"
"$bumpstretch" "models/cra0kalo/kovic/Kovic_normal_stretch"
}
</pre>


=== VMT Parameters ===
SetWrinkleScale("BrowInV", "WrinkleNose", -0.5) -- controller name, shape name, scale
The following is a list of VMT parameters that are needed to enable the WrinkleMaps:
SetWrinkleScale("BrowInV", "RaiseBrowIn", 2)
:<code>$compress "path/to/vtf"</code> -Compression wrinklemap diffuse
-- etc.
:<code>$stretch "path/to/vtf"</code>  -Expansion wrinklemap diffuse
:<code>$bumpcompress "path/to/vtf"</code> -Compression wrinklemap normal
:<code>$bumpstretch "path/to/vtf"</code>  -Expansion wrinklemap normal


=== Other VMT Params ===
ComputeWrinkles()


<pre>
Save("C:/heavy_morphs_high.dmx")
// ------------------------------------
</source>
// Displacement Maps
// ------------------------------------
// Displacement map
"$displacementmap" "models/cra0kalo/basetexture"
// Displacement map contains wrinkle displacements
"$displacementwrinkle" "0" //boolean


Run <code>dmxedit -help</code> for more details.


</pre>
=== Blender SMD Tools ===


== References ==
The [[Blender SMD Tools]] can generate wrinkle maps when exporting your model. Enable [[Blender SMD Tools Help#Flex properties|Advanced flex mode]], generate a flex controller block, and set a non-zero <code>wrinkleScales</code> value in the relevant flex controller definitions.


*[http://www.youtube.com/watch?v=yrzAeZyogbU Source Engine WrinkleMaps HWM [SFM]]
== Materials and textures ==


[[File:Valve_l4d2_wrinkle.png|thumb|A <code>$compress</code> texture from [[Left 4 Dead 2]].]]


There are four <code>[[VertexLitGeneric]]</code> VMT parameters related to wrinkle maps:


; <code>$compress</code>
; <code>$stretch</code>
: Path to [[texture]]s which are applied when a flex controller compresses or stretches the mesh.
; <code>$bumpcompress</code>
; <code>$bumpstretech</code>
: Optional [[bump map]]s for <code>$compress</code> and <code>$stretch</code>.


[[Category:List of Shader Parameters|A]]
[[Category:Modeling]]
[[Category:VMT Lighting]]

Revision as of 14:51, 26 September 2013

Wrinkle maps add fine detail to the forehead.

Wrinkle maps are a component of DMX flex shapes which make per-vertex changes to a model's texture when the flex 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. 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")

Run dmxedit -help for more details.

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

A $compress texture from Left 4 Dead 2.

There are four VertexLitGeneric VMT parameters related to wrinkle maps:

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