$blendmodulatetexture: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
  
  
Tip:You should use 
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 (Confirmed that using $detail along $blendmodulatetexture causes not graphical issues in Garry's Mod.)  | 
				SirYodaJedi (talk | contribs)   | 
				||
| Line 33: | Line 33: | ||
{{MatParam|$maskedblending|bool|Makes the shader use the modulation texture for the blend factor instead of using the vertex alpha from the displacement. {{bug|The surface must still be a displacement in order to blend properly.}}}}  | {{MatParam|$maskedblending|bool|Makes the shader use the modulation texture for the blend factor instead of using the vertex alpha from the displacement. {{bug|The surface must still be a displacement in order to blend properly.}}}}  | ||
{{todo|{{csgo}} added some parameters with an alternative method using a greyscale modulation texture; these can be prominently seen in {{csgo map|de_ancient|game=csgo}}'s materials. Document this.}}  | |||
== Blend Modulation Textures ==  | == Blend Modulation Textures ==  | ||
Revision as of 10:45, 16 April 2025
Without vs With. The technique was first used in 
 Day of Defeat: Source's snow maps, such as Kalt.
The green channel of 
 Day of Defeat: Source's 
Several (non-snowy)
 Left 4 Dead series materials also use this texture, under a different name.
ground/snowblendtexture.vtf.Several (non-snowy)
$blendmodulatetexture  is a   material shader parameter for the LightmappedGeneric and WorldVertexTransition shader available in all 
 Source games since 
 Source 2006. It changes the transition between the textures from a smooth, linear gradient to one "stamped" with a pattern.
$blendmodulatetexture wherever possible, as the improvement in visual quality is immense!Caveats
- Incompatible with $normalmapalphaenvmapmask in 
. Works in 
. (use $envmapmask instead). 
- Todo: Only in later games? If so, which?
 
- Incompatible with $selfillum in 



. - Incompatible with $bumpmap and $detail being used at the same time, in 
 Alien Swarm. - Using 
$blendmodulatetexturewith $detail will cause a major graphical issue ( stripes over the texture ), except in
 and 
. - Incompatible with $detailblendmode 7 in 

 and 9 in 
 - In 
 Source 2006, 
 Source 2007, and 
 Team Fortress 2, incompatible with $basetexturetransform and $detail. - In 
 Source 2006, also incompatible with $envmaptint and $envmapmask. - 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. - In 
 Alien Swarm, not compatible with $bumptransform. 
In some additional cases, textures will blend as if $blendmodulatetexture were not used:
- Does not display when viewed through water. Todo: Only in earlier games?
 - Does not display when illuminated with player's flashlight in 
 Half-Life 2. This is fixed in 
 Mapbase. - Does not display in the Hammer Editor in most games. Known exceptions include 
 Counter-Strike: Global Offensive, 
 Portal 2, 
 Garry's Mod, 
 Left 4 Dead 2, and 
 Mapbase. 
Parameters
$blendmodulatetexture
$blendmasktransform
Todo: 
 added some parameters with an alternative method using a greyscale modulation texture; these can be prominently seen in 
 de_ancient's materials. Document this.
Blend Modulation Textures
Only two color channels are read from the texture:
- 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.
 - 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.
 
There is not always a need for the texture to be high resolution—high-frequency blends can be produced from low-res textures.