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

VertexLitGeneric

From Valve Developer Community
Jump to navigation Jump to search
English (en)Français (fr)Translate (Translate)

VertexLitGeneric is a vertex shader available in all Source Source games. It is the shader most commonly used to render models, and supports a variety of effects. Do not use this on world geometry, else you may encounter lighting bugs.

Supported Parameters

Basics

$basetexture defines albedo texture.
Detail texturing.
$decaltexture <texture> (only in Counter-Strike: Global Offensive)
Use a 2nd UV channel for high-resolution decal support.

Adjustment

Transform $basetexture's alignment, scale, rotation and position.
$allowdiffusemodulation <boolean> (in all games since Left 4 Dead)
Prevents the model's material from being tinted by $color2 or rendercolor.
$seperatedetailuvs <boolean> (in all games since Source 2007)
Todo: Confirm use of texcoord1 for detail texture
$desaturatewithbasealpha <float> (in all games since Alien Swarm)
Use the base alpha to desaturate the base texture. Set to non-zero to enable, value gets multiplied into the alpha channel before desaturating.
$notint <boolean> (only in Counter-Strike: Global Offensive) (also in Portal 2: Community Edition)
Prevents the model's material from being tinted by $color2 or rendercolor.

Transparency

VertexLitGeneric support a few different methods for transparency, each for different purposes

$alpha Cheaply scales the opacity of an entire material.
Confirm:Does this work in any engine branch? It does not in Source 2013 Multiplayer.
$alphatest is a Cheap transparency using a binary opacity mask.
$nocull disables backface culling optimization.
$translucent is a expensive translucency using a full Alpha mask, for very fine gradients.
Note.pngNote:Add material sorting issues
$additive alike $translucent perform full Alpha mask, however it add colors instead of performing a multiplication. This renders in a always brighter material.
$distancealpha <boolean> (in all games since Source 2007)
$distancealpha is a vector-like edge filtering.

Lighting

$lightwarptexture <texture> (in all games since Source 2006)
1 dimension Per-texel color modification via a warp texture.
Determines whether the surface is self-illuminated independent of environment lighting.
$lightmap <texture> (only in Source 2013 Multiplayer) (also in Garry's Mod)
Pre-baked lightmap; subject to limitations.

Reflection

$phong <boolean> (in all games since Source 2006)
$rimlight <boolean> (in all games since Source 2007)
Constant rimlight based on phong and the ambient lighting.

Effect

$compress <texture> (in all games since Source 2007)
Wrinklemaps for character faces.
$stretch <texture> (in all games since Source 2007)
Wrinklemaps for character faces.
$flesh <boolean> (in all games since Source 2007)
The flesh effect used for Alyx in Half-Life 2: Episode Two.
$treeSway <boolean> (in all games since Left 4 Dead) (also in Team Fortress 2MapbaseGarry's ModBlack Mesa)
Vertex manipulation to give the effect of trees swaying in the wind.

Technical Workarounds

$flashlightnolambert <boolean> (in all games since Source 2007)
Tell projected textures such as the flashlight to ignore the surface normal of the model. Useful for models with $nocull such as foilage. Otherwise, lighting the face with a flashlight from behind will not affect it. Default 0.
$lowqualityflashlightshadows <boolean> (in all games since Portal 2)
Force low quality flashlight/projected texture shadows for faster performance.
$allowfencerenderstatehack <boolean> (in all games since Counter-Strike: Global Offensive)
Fence render hack for cascade shadow maps, allows shadow maps to work properly with fences.
$disablecsmlookup <boolean> (in all games since Counter-Strike: Global Offensive)
Disable cascade shadow map lookup/filtering, useful on dense foilage.
$noshadowpass <boolean> (only in Lambda Wars)
Allows turning off the shadow pass of this material.
$nodeferredlight <boolean> (only in Lambda Wars)
No deferred light input.
$modelglobalnormal <boolean> (only in Lambda Wars)
Use global light direction as normal for all model vertices.

Cloak

VertexLitGeneric natively supports the Spy cloak effect from Team Fortress 2 Team Fortress 2 . Combine it with a sine wave proxy for the full effect.

Enables cloaking effects.
Warning.pngWarning:Enabling this on static props causes a heavy performance penalty, even if the cloak effect itself isn't being used!
0.00 = fully visible,
1.00 = fully invisible.
Colors the refraction effect. Default " [ 1 1 1 ] ".
How strong the refraction effect should be when the material is partially cloaked. Default 2.

Caveats

Mapbase

VertexLitGeneric materials in Mapbase should have the shader SDK_VertexLitGeneric.

See also