Wrinkle maps: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Fix typo)
m (added language bar.)
Line 1: Line 1:
{{lang|Wrinkle maps|title=Wrinkle Maps}}[[Category:Glossary]][[Category:Modeling]]
[[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]] 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. They were introduced in {{Game link|Source 2007}}.
[[Wrinkle maps]] are a component of [[DMX model|DMX]] [[Flex animation|flex shapes]] used by the {{ent|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. They were introduced in {{Src07|4}}.


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.


== Generation ==
== 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.
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.
* Negative wrinkle scales lead to the stretch texture being applied.
* Negative wrinkle scales lead to the stretch texture being applied.
Line 14: Line 13:
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.
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 ===
===<tt>dmxedit</tt>===
 
The official SDK tool for creating wrinkle maps is {{ent|dmxedit}}. It is run on an exported DMX using a simple [[w:Lua (programming language)|Lua]] script like this:
The official SDK tool for creating wrinkle maps is <code>[[dmxedit]]</code>. It is run on an exported DMX using a simple [[w:Lua (programming language)|Lua]] script like this:


<source lang=lua>
<source lang=lua>
Line 30: Line 28:
</source>
</source>


If you are using [[Source Filmmaker]] you will find a collection of helper files at <code>SourceFilmmaker\game\sdktools\lua\</code>. These can be used to set up your model in the same way as Valve's.
If you are using {{sfm|2}}, you will find a collection of helper files at <tt>SourceFilmmaker\game\sdktools\lua\</tt>. These can be used to set up your model in the same way as Valve's.
 
=== Blender Source Tools ===


=== {{blender|4}} Source Tools ===
The [[Blender Source 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.
The [[Blender Source 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.


=== Wall Worm Model Tools ===
=== 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.
[[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.


You can find the [http://dev.wallworm.com/document/162/wrinklemaps.html docs and a tutorial on doing wrinklemaps in 3ds Max here].
You can find the [http://dev.wallworm.com/document/162/wrinklemaps.html docs and a tutorial on doing wrinklemaps in 3ds Max here].


== Materials and textures ==
== Materials and Textures ==
 
[[File:Valve_l4d2_wrinkle.png|thumb|A <code>$compress</code> texture from {{l4d2|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.
Implementing wrinkle maps requires a {{ent|VertexLitGeneric}} material with {{ent|$phong}} enabled.


There are four shader parameters involved:
There are four shader parameters involved:
{{MatParam|$compress|texture|}}
{{MatParam|$compress|texture|}}
{{MatParam|$stretch|texture|Textures which are applied when a flex controller compresses or stretches the mesh.}}
{{MatParam|$stretch|texture|Textures which are applied when a flex controller compresses or stretches the mesh.}}
{{MatParam|$bumpcompress|texture|}}
{{MatParam|$bumpcompress|texture|}}
{{MatParam|$bumpstretch|texture|Optional [[bump map]] textures for <code>$compress</code> and <code>$stretch</code>.}}
{{MatParam|$bumpstretch|texture|Optional [[bump map]] textures for <code>$compress</code> and <code>$stretch</code>.}}
[[Category:Modeling]]

Revision as of 19:54, 25 May 2022

English (en)Translate (Translate)
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. They were introduced in Source 2007 Source 2007.

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 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 Blender Source Tools

The Blender Source 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.

You can find the docs and a tutorial on doing wrinklemaps in 3ds Max here.

Materials and Textures

A $compress texture from Left 4 Dead 2 Left 4 Dead 2.

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

There are four shader parameters involved: $compress $stretch $bumpcompress $bumpstretch