$blendmodulatetexture: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (added language bar.)
m (Additional Information - Caveats for primarily Alien Swarm and CSGO)
Line 9: Line 9:


== Caveats ==
== Caveats ==
* Incompatible with {{ent|$normalmapalphaenvmapmask}} (use {{ent|$envmapmask}} instead). {{todo|Only in later games?}}
* Incompatible with {{ent|$normalmapalphaenvmapmask}} in {{as}}. Works in {{csgo}}. (use {{ent|$envmapmask}} instead).
:{{todo|Only in later games? If so, which?}}
* Incompatible with {{ent|$selfillum}} in {{src13}}{{tf2}}{{csgo}}{{as}}.
* Incompatible with {{ent|$bumpmap}} and {{ent|$detail}} being used at the same time, in {{as|4}}.
* Incompatible with [[$detail#Parameters and Effects|$detailblendmode]] 7 in {{as}}{{csgo}} and 9 in {{csgo}}
* In {{src06|4}}, {{src07|4}}, and {{tf2|4}}, incompatible with {{ent|$basetexturetransform}} and {{ent|$detail}}.
* In {{src06|4}}, {{src07|4}}, and {{tf2|4}}, incompatible with {{ent|$basetexturetransform}} and {{ent|$detail}}.
* In {{src06|4}}, also incompatible with {{ent|$envmaptint}} and {{ent|$envmapmask}}.
* In {{src06|4}}, also incompatible with {{ent|$envmaptint}} and {{ent|$envmapmask}}.
* In {{as|4}}, modulation textures are not aligned correctly. Use <code>$blendmasktransform "center .5 .5 scale 1 -1 rotate 90 translate 0 0"</code> to fix them up.
* In {{as|4}}, modulation textures are not aligned correctly. Use <code>$blendmasktransform "center .5 .5 scale 1 -1 rotate 90 translate 0 0"</code> to fix them up.
* In {{as|4}}, not compatible with {{ent|$bumptransform}}.


In some additional cases, textures will blend as if <code>$blendmodulatetexture</code> were not used:
In some additional cases, textures will blend as if <code>$blendmodulatetexture</code> were not used:

Revision as of 15:58, 17 February 2023

English (en)Translate (Translate)
Without vs With. The technique was first used in Day of Defeat Day of Defeat's snow maps, such as Kalt.
The green channel of DOD's ground\snowblendtexture.
A custom blend modulation mask (all channels) side-by-side its affected texture rendered in-game.

Template:Shaderparam It changes the transition between the textures from a smooth, linear gradient to one "stamped" with a pattern.

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

Caveats

Todo: Only in later games? If so, which?

In some additional cases, textures will blend as if $blendmodulatetexture were not used:

Parameters

$blendmodulatetexture $blendmasktransform

$maskedblending

Blend Modulation 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 color 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.