$blendmodulatetexture: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (→‎Modulate Texture: 7.5 incompatible. (Syntax))
No edit summary
Line 8: Line 8:
{{note|Incompatible with [[$basetexturetransform]] and [[$detail]].}} (transform works at Alienswarm, confirm is needed for other games)
{{note|Incompatible with [[$basetexturetransform]] and [[$detail]].}} (transform works at Alienswarm, confirm is needed for other games)
{{note|In the 2006 engine, incompatible with [[$envmaptint]] and [[$envmapmask]].}}
{{note|In the 2006 engine, incompatible with [[$envmaptint]] and [[$envmapmask]].}}
{{note|A modulate texture set to '''version 7.5''' is incompatible with '''L4D2'''{{L4d2}}, '''HL2'''{{HL2}} ~ '''EP2'''{{Ep2}}. (known) Use '''7.4''' instead.}}
{{note|A .''VTF'' file extracted from '''Alienswarm'''{{As}} (''VTF;7.5'') is not compatible with other Source games(''VTF;''-7.4)({{L4d2}}, {{Hl2}}...).}}  
{{bug|Incompatible with [[$normalmapalphaenvmapmask]]. Use [[$envmapmask]](and or 2) instead.}}
{{bug|Incompatible with [[$normalmapalphaenvmapmask]]. Use [[$envmapmask]](and or 2) instead.}}



Revision as of 03:32, 15 April 2011

The technique was first used in Day of Defeat's snow maps, such as Kalt.
The green channel of DOD's ground\snowblendtexture.

$blendmodulatetexture is a material parameter for the WorldVertexTransition shader. It changes the transition between the textures from a smooth, linear gradient to one "stamped" with a pattern.

You should use $blendmodulatetexture wherever possible, as the improvement in visual quality is immense!

Note.pngNote:Incompatible with $basetexturetransform and $detail.

(transform works at Alienswarm, confirm is needed for other games)

Note.pngNote:In the 2006 engine, incompatible with $envmaptint and $envmapmask.
Note.pngNote:A .VTF file extracted from AlienswarmAlien Swarm (VTF;7.5) is not compatible with other Source games(VTF;-7.4)(Left 4 Dead 2, Half-Life 2...).
Icon-Bug.pngBug:Incompatible with $normalmapalphaenvmapmask. Use $envmapmask(and or 2) instead.  [todo tested in ?]

Blend modulate textures

Tip.pngTip:The best way to create a modulation texture is to import the two albedos to an image editor as layers, and create an alpha channel there by hand.

Only two colour channels are read from the texture:

Green
Biases toward $basetexture2. 128 is normal.
The idea is to paint noise and patterns into this channel, so that the edge between the two textures becomes irregular. Valve's snow texture (see right) has lots of ragged edges in the green channel, and even some bootprints. There are also lines painted along the edges of the albedo's bricks that give them a tendency to have snow along their edges.
Red
Sharpens. 0 makes the transition binary, 255 effectively disables modulation.
The red channel of Valve's snow modulation texture is a constant 99, which produces a fairly sharp falloff. Using different values in different places has the potential to produce a more complex effect.

There is not always a need for the texture to be high resolution - high frequency blends can be produced from low-re textures.