WorldVertexTransition

From Valve Developer Community
Jump to: navigation, search
Application without and with $blendmodulatetexture.

WorldVertexTransition is a material shader available in all Source games. It is a shader functionally similar to LightmappedGeneric primarily used to perform a per-vertex linear blend between two textures on a displacement surface. Many of the parameter definitions for the secondary material are the same as the first material except with a "2" at the end. ex: $basetexture2

You can choose which texture you would like to appear on a vertex using Hammer's alpha painting tool. The blend is normally a linear gradient, but you can control the blend on a per-pixel basis by specifying $blendmodulatetexture in the material.

Caveats

Note:You can also use $vertexalpha to create a material that fades out. This uses the first $basetexture then fades out with the blend. Unfortunately, it is treated the same as a material with $translucent and can have sorting issues with other transparency objects.
Note:This shader now only works on displacements. If used on a regular brush, VBSP will generate and pack a LightmappedGeneric version of the material automatically, discarding the secondary texture.
Note:The shader LightmappedGeneric does texture blending as well and supports many of the same features as this shader.
Bug: $blendmodulatetexture does not display in hammer despite the shader LightmappedGeneric displaying it correctly. Instead it displays a linear blend. This has been fixed in <Garry's Mod>

To do: This shader was significantly upgraded in <Counter-Strike: Global Offensive> with new parameters, a new layer blending mode, drop shadows, and support for layer-specific detail textures and specular masks. Document these.

Example

WorldVertexTransition
{
	$basetexture nature/dirtfloor006a
	$surfaceprop dirt

	$basetexture2 nature/rockfloor005a
	$surfaceprop2 rock

	%tooltexture nature/blendrockgrass004a_tooltexture
}
  • Some visual effects can be selectively applied to one sub-material or the other. See the relevant articles for more details.
  • The Hammer material browser won't be able to display a preview of the material unless it's given a %tooltexture.

Supported Parameters

$basetexture <texture>
The first texture in the blend.
$basetexture2 <texture>
The second texture to blend to.
$bumpmap <texture>
bumpmap for the first texture.
$bumpmap2 <texture>
bumpmap for the second texture.
$blendmodulatetexture <texture> (in all games since <Source><Source>)
Modulate the blending between materials using a special texture.
$detail <texture>
Detail texturing. Applies the same detail texture to both materials. In <Counter-Strike: Global Offensive>, each layer can use their own detail texture.
$envmap <texture>
Specular reflections. In <Counter-Strike: Global Offensive>, each layer can have their own specular mask. To do: Might disable $blendmodulatetexture if both are used.
$lightwarptexture <texture> (in all games since <Source><Source>)
Per-texel color modification via a warp texture. Applies the lightwarp to both materials.
$seamless_scale <float> (in all games since <Source><Source>)
Mitigation for displacement texture stretching.
$selfillum <boolean>
Self-illumination. Applies the self-illumination to both materials. To do: Might disable $blendmodulatetexture if both are used.
$ssbump <boolean> (in all games since <Source><Source>)
Self-shadowing bumpmapping. If two bumpmaps are used, both must be self-shadowing bumpmaps in order for this to work properly.
$translucent <boolean>
$alpha <float>
Expensive and cheap transparency. Applies the transparency to both materials.
$vertexalpha <boolean>
Causes the material to blend between the primary texture and full transparency. Automatically marks the material as $translucent.
$additive <boolean>
Adds the color of the pixels on the surface with the pixels of objects behind it.
$phong <boolean> (only in <Counter-Strike: Global Offensive>)
Diffuse reflections.
%detailtype <string>
Specifies what Detail props to spawn on the material. The string should be the name of a detail type outlined in "detail.vbsp" or your specified .vbsp file.

See also