$blendmodulatetexture: Difference between revisions
Jump to navigation
Jump to search
Tip: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.
m (Removing Russian youtube advertising.) |
Deprecated (talk | contribs) (Changed to use Shaderparam and MatParam templates) |
||
Line 3: | Line 3: | ||
[[File:Blendmod_mockup.jpg|thumb|250px|A custom blend modulation mask (all channels) side-by-side its affected texture rendered in-game.]] | [[File:Blendmod_mockup.jpg|thumb|250px|A custom blend modulation mask (all channels) side-by-side its affected texture rendered in-game.]] | ||
{{Shaderparam|$blendmodulatetexture|since=Source 2006|shader1=WorldVertexTransition}} It changes the transition between the textures from a smooth, linear gradient to one "stamped" with a pattern. | |||
You should use <code>$blendmodulatetexture</code> wherever possible, as the improvement in visual quality is immense! | You should use <code>$blendmodulatetexture</code> wherever possible, as the improvement in visual quality is immense! | ||
Line 18: | Line 18: | ||
== Parameters == | == Parameters == | ||
{{MatParam|$blendmodulatetexture|texture|The modulation texture for the blending. See below for more details.}} | |||
{{MatParam|$blendmasktransform|matrix|Transforms the modulation texture before use in the material. | |||
{{VMT UVtransform}}|dx9=1}} | |||
{{VMT UVtransform}} | |||
== Blend | == Blend Modulation Textures == | ||
{{tip|The best way to create a modulation texture is to import the two [[albedo]]s to an image editor as layers, and create an alpha channel there by hand.}} | {{tip|The best way to create a modulation texture is to import the two [[albedo]]s to an image editor as layers, and create an alpha channel there by hand.}} |
Revision as of 08:23, 26 June 2019
Template:Shaderparam 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!
Caveats
- Incompatible with $normalmapalphaenvmapmask (use $envmapmask instead).
- In Source 2006/2007 and Team Fortress 2, incompatible with $basetexturetransform and $detail.
- In Source 2006, incompatible with $envmaptint and $envmapmask.
- Does not work underwater; when viewed through water, the textures will blend as if $blendmodulatetexture were not used.
- Does not display correctly when illuminated with player's flashlight in
Half-Life 2.
Bug:
In Alien Swarm, modulation textures are not aligned correctly. Use
$blendmasktransform "center .5 .5 scale 1 -1 rotate 90 translate 0 0"
to fix them up. [todo tested in ?]
Parameters
$blendmodulatetexture
$blendmasktransform
Blend Modulation Textures

Only two colour channels are read from the texture:
- Green
- Biases in favor of
$basetexture
; high-value areas will be the most resistant to modulation. 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-res textures.