This article's documentation is for anything that uses the Source engine. Click here for more information.

WorldVertexTransition: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
(27 intermediate revisions by 13 users not shown)
Line 1: Line 1:
{{update}}
[[File:Blendmodulate.jpg|thumb|250px|Application without and with <code>[[$blendmodulatetexture]]</code>.]]
[[File:Blendmodulate.jpg|thumb|250px|Application without and with <code>[[$blendmodulatetexture]]</code>.]]


'''<code>WorldVertexTransition</code>''' is the [[shader]] used to blend the vertices of a [[displacement]] surface between two different materials. It handles two at once by using a mirrored set of parameters with "2" in their name.
{{this is a|pixel shader|name=WorldVertexTransition}} 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


The pattern of the blend is defined by Hammer's [[Displacement#Blended displacement materials (alpha channel painting)|alpha painting tool]]. The blend is normally a linear gradient, but it can also be "stamped" by a texture specified with <code>[[$blendmodulatetexture]]</code>. This command makes the material look considerably better for very little [[budget|cost]] - use it often!
You can choose which texture you would like to appear on a vertex using Hammer's [[Displacement#Blended displacement materials (alpha channel painting)|alpha painting tool]]. The blend is normally a linear gradient, but you can control the blend on a per-pixel basis by specifying {{ent|$blendmodulatetexture}} in the material.


{{note|This shader now '''only''' works on displacements.}}
{{important|In {{Bms|4}} this shader was missed in the deferred renderer update. Instead, use {{ent|LightmappedGeneric}}, which, in {{bms|4}}, has all the features of {{ent|WorldVertexTransition}}.}}
 
==Caveats==
 
{{note|You can also use {{ent|$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 {{ent|$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 {{ent|LightmappedGeneric}} version of the material automatically, discarding the secondary texture.}}
{{note|The shader {{ent|LightmappedGeneric}} does texture blending as well and supports many of the same features as this shader.{{ModernConfirm|Does WorldVertexTransition support any features that LightmappedGeneric does not?}}}}
{{bug|{{ent|$blendmodulatetexture}} does not display in hammer despite the shader {{ent|LightmappedGeneric}} displaying it correctly. Instead it displays a linear blend. This has been fixed in {{GMOD}}}}
{{todo|This shader was significantly upgraded in {{csgo}} with new parameters, a new layer blending mode, drop shadows, and support for layer-specific detail textures and specular masks. Document these.}}


==Example==
==Example==
Line 20: Line 29:
  }
  }


* Just about all visual effects can be selectively applied to one sub-material or the other. See the relevant articles for more details.
* 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 <code>[[%tooltexture]]</code>.
* The Hammer material browser won't be able to display a preview of the material unless it's given a <code>[[%tooltexture]]</code>.


== Supported effects ==
== Supported Parameters ==


* <code>[[$blendmodulatetexture]]</code>
{{MatParamDef|$basetexture|texture| The first texture in the blend.}}
* <code>[[$seamless_scale]]</code>
{{MatParamDef|$basetexture2|texture| The second texture to blend to.}}
* <code>[[$bumpmap]]</code>
{{MatParamDef|$bumpmap|texture|bumpmap for the first texture.}}
* <code>[[$ssbump]]</code> (whole material only)
{{MatParamDef|$bumpmap2|texture| bumpmap for the second texture.}}
* <code>[[$detail]]</code> (whole material only)
{{MatParamDef|$blendmodulatetexture|texture|since={{src06}}|Modulate the blending between materials using a special texture.}}
* <code>[[$envmap]]</code> (might disable <code>[[$blendmodulatetexture]]</code> if both used)
{{MatParamDef|$detail|texture| Detail texturing. Applies the same detail texture to both materials. In {{csgo}}, [[$detail#CS:GO_WorldVertexTransition_Parameters|each layer can use their own detail texture.]]}}
* {{todo|<code>[[$outline]]</code>?}}
{{MatParamDef|$envmap|texture|Specular reflections. In {{csgo}}, [[$envmapmask#CS:GO_WorldVertexTransition_Parameters|each layer can have their own specular mask.]] {{todo|Might disable <code>$blendmodulatetexture</code> if both are used.}} }}
* <code>[[$translucent]]</code> and <code>[[$alpha]]</code> (whole material only)
{{MatParamDef|$lightwarptexture|texture|since={{src06}}| Per-texel color modification via a warp texture. Applies the lightwarp to both materials.}}
{{MatParamDef|$seamless_scale|float|since={{src07}}| Mitigation for displacement texture stretching.}}
{{MatParamDef|$selfillum|bool| Self-illumination. Applies the self-illumination to both materials. {{todo|Might disable <code>$blendmodulatetexture</code> if both are used.}} }}
{{MatParamDef|$ssbump|bool|since={{src07}}|Self-shadowing bumpmapping. If two bumpmaps are used, both must be self-shadowing bumpmaps in order for this to work properly.}}
{{MatParamDef|$translucent|bool}}
{{MatParamDef|$alpha|float| Expensive and cheap transparency{{clarify}}. Applies the transparency to both materials.}}
{{MatParamDef|$vertexalpha|bool| Causes the material to blend between the primary texture and full transparency. Automatically marks the material as {{ent|$translucent}}. Requires <code>$vertexcolor</code> to be set to 1.}}
{{MatParamDef|$additive|bool| Adds the color of the pixels on the surface with the pixels of objects behind it.}}
{{MatParamDef|$phong|bool|only={{csgo}}{{mapbase}}| Diffuse reflections.}}
{{MatParamDef|$phong_exp|only={{lw}}|float|{{confirm|Is this for LW's Blinn–Phong reflections?}}}}
{{MatParamDef|$phong_exp2|only={{lw}}|float|{{confirm|Is this for LW's Blinn–Phong reflections?}}}}
{{MatParamDef|$layertint1|color255|only={{csgo}}| SRGB tint layer 1.}}
{{MatParamDef|$layertint2|color255|only={{csgo}}}| SRGB tint layer 2.}}
{{MatParamDef|%detailtype|string| Specifies what {{ent|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.
{{note|On some materials, the sprites only show up on $basetexture, but not on $basetexture2. This may also happen when you make your own blend material using rocks and grass. If rock is $basetexture, only the rock will have grass sprites, which looks odd.}}}}


== See also ==
== See also ==


* <code>[[LightmappedGeneric]]</code>
* [[LightmappedGeneric]], the standard shader for lightmapped surfaces.
* <code>[[Lightmapped_4WayBlend]]</code>
* [[Lightmapped_4WayBlend]], an upgraded displacement blend shader for {{csgo}}.
* <code>[[WorldTwoTextureBlend]]</code>
* [[LightmappedTwoTexture]], a brush shader that multiplies a texture on top of another one.
* <code>[[LightmappedTwoTexture]]</code>
* [[WorldTwoTextureBlend]], a brush shader that applies a texture on top of another one using $detail.
* [[Displacement]]
* [[Displacement]], the surface type this shader is used on.


[[Category:Shaders]]
[[Category:Shaders]]

Latest revision as of 11:40, 23 August 2025

Broom icon.png
This article or section needs to be updated to include current information regarding the subject.
Remember to check for any notes left by the tagger at this article's talk page.
Application without and with $blendmodulatetexture.

WorldVertexTransition is a Pixel shader available in all Source 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.

Icon-Important.pngImportant:In Black Mesa Black Mesa this shader was missed in the deferred renderer update. Instead, use LightmappedGeneric, which, in Black Mesa Black Mesa, has all the features of WorldVertexTransition.

Caveats

Note.pngNote: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.pngNote: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.pngNote:The shader LightmappedGeneric does texture blending as well and supports many of the same features as this shader.
Confirm:Does WorldVertexTransition support any features that LightmappedGeneric does not?
Icon-Bug.pngBug:$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  [todo tested in ?]
Todo: 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

The first texture in the blend.
The second texture to blend to.
bumpmap for the first texture.
bumpmap for the second texture.
$blendmodulatetexture <texture> (in all games since Source 2006)
Modulate the blending between materials using a special texture.
Detail texturing. Applies the same detail texture to both materials. In Counter-Strike: Global Offensive, each layer can use their own detail texture.
Specular reflections. In Counter-Strike: Global Offensive, each layer can have their own specular mask.
Todo: Might disable $blendmodulatetexture if both are used.
$lightwarptexture <texture> (in all games since Source 2006)
Per-texel color modification via a warp texture. Applies the lightwarp to both materials.
$seamless_scale <float> (in all games since Source 2007)
Mitigation for displacement texture stretching.
Self-illumination. Applies the self-illumination to both materials.
Todo: Might disable $blendmodulatetexture if both are used.
$ssbump <boolean> (in all games since Source 2007)
Self-shadowing bumpmapping. If two bumpmaps are used, both must be self-shadowing bumpmaps in order for this to work properly.
Todo: This material shader parameter has not been described.
Expensive and cheap transparency[Clarify]. Applies the transparency to both materials.
Causes the material to blend between the primary texture and full transparency. Automatically marks the material as $translucent. Requires $vertexcolor to be set to 1.
Adds the color of the pixels on the surface with the pixels of objects behind it.
$phong <boolean> (only in Counter-Strike: Global OffensiveMapbase)
Diffuse reflections.
$phong_exp <float> (only in Lambda Wars)
Confirm:Is this for LW's Blinn–Phong reflections?
$phong_exp2 <float> (only in Lambda Wars)
Confirm:Is this for LW's Blinn–Phong reflections?
$layertint1 <color255> (only in Counter-Strike: Global Offensive)
SRGB tint layer 1.
$layertint2 <color255> (only in Counter-Strike: Global Offensive})
SRGB tint layer 2.
[[%detailtype|%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.
Note.pngNote:On some materials, the sprites only show up on $basetexture, but not on $basetexture2. This may also happen when you make your own blend material using rocks and grass. If rock is $basetexture, only the rock will have grass sprites, which looks odd.

See also