Shader Types and Parameters

From Valve Developer Community
Revision as of 22:28, 12 February 2008 by Andreasen (talk | contribs) (Main list: Removed folderized duplicates.)
Jump to: navigation, search

Shader types

Shaders according to folders

The following list of shaders is partially categorized according to the folders found in the unpacked Source Materials.gcf. This is to eliminate listing many folder/material exclusive shaders, to prevent beginners from being overwhelmed with unnecessary shader names. (See the talk-page of this article for a rationale.)

If you are looking for a single (though currently incomplete) reference list, you can instead find it here.

Note that many folders are not yet categorized. In order to add a new entry, please search each material in the folder for shaders (by manually opening them and checking their contents). It may be very tedious work, but it is the only way to discover the more rare shaders.

Main list

This is a list of common shaders, and shaders not yet categorized according to folder. (Check the folders before adding new shaders. We do not want duplicate entries.)

Shader Name Description Parameter Notes
eyes Used for realistic eyeballs for models.
LightmappedGeneric The most common texture. A basetexture is multiplied by a lightmap. Only the $basetexture line is required.

$albedo, $selfillumtint, $detail, $detailframe (dx9), $detailscale, $envmap, $envmapframe, $envmapmask, $envmaskframe, $envmapmasktransform (dx9), $envmapmaskscale (dx8), $envmaptint, $bumpmap, $bumpframe, $bumptransform, $envmapcontrast, $envmapsaturation, $fresnelreflection, $nodiffusebumplighting (dx9), $bumpmap2 (dx9), $bumpmapframe2 (dx9), $frame2 (dx9), $basetexturenoenvmap (dx9), $basetexture2noenvmap (dx9), $detail_alpha_mask_base_texture (dx9)

Refract Refracts the light behind it according to a dudvmap and bumpmap. Only works correctly on models. If used on a model, Set "$model" 1
UnlitGeneric A basetexture appears at full brightness. If used on a model, set "$model" 1.
UnlitTwoTexture Two textures are mixed evenly and appear at full brightness.
VertexLitGeneric A basetexture with vertex lighting. $albedo (dx9), $selfillumtint, $detail, $detailframe (dx9), $detailscale, $envmap, $envmapframe, $envmapmask, $envmaptransform (dx9), $envmapmaskscale (dx8), $envmaptint, $bumpmap, $bumpmapframe, $bumptransform, $envmapcontrast, $envmapsaturation
Water For fallbacks for this shader, see Shaders in Nature\.
WorldTwoTextureBlend A partially transparent detail texture is blended on top of the base texture, according to the alpha channel of the detail texture. $basetexture <texture>, $detail <texture>, $detailscale <float>, $surfaceprop <type>.

Fully verified folders

These folders are those in which every single VMT file has been searched for shaders (as of 31-01-2008).

Unknown shaders

Many shaders previously listed on this page came from a very old list that lists shaders that isn't used by any current materials in source materials.gcf. It is uncertain if these shaders are working, or how to use them. This is why they are in this separate list.

Shader parameters

Texture references

"$basetexture" "path to base texture"
Basic color map.
"$basetexture2" "path to 2nd base texture"
Used for the WorldVertexTransition shader.
"$bumpmap" "path to normal map"
Defines normal vectors for lighting purposes and for envmap distortion
"$bumpmap2" "path to normal map"
Used for the WorldVertexTransition shader.
"$parallaxmap" "path to height map"
Use for parallax mapping. Not functional.
"$texture2" "path to 2nd base texture"
Used for "twotexture"-type shader.
"$detail" "path to detail texture"
Greyscale image usually used at higher resolution to add detail to the base texture. Used in conjunction with "$detailscale".

Texture adjustment

"$bumpscale" <float>
"$parallaxmapscale" <float>
"$detailscale" <float>
Number of times the detail texture will scale in the base texture.
"$basetexturetransform" "center <float> <float> scale <float> <float> rotate <float> translate <float> <float>"
"$basetexturetransform2" "center <float> <float> scale <float> <float> rotate <float> translate <float> <float>"
"center" and "translate" are in UV 0..1 coordinates, "rotate" is in angles.
You must include all variables. The defaults are: center .5 .5 scale 1 1 rotate 0 translate 0 0.

World interaction

"$surfaceprop" "surface property"
Defines the gib types and impact sounds of the material. See Material Surface properties for more information.


"$basealphaenvmapmask" 1
Uses $basetexture's alpha channel as an envmap mask.
"$envmap" "env_cubemap"
Uses nearest env_cubemap for reflection.
"$envmapcontrast" float
contrast 0 == normal 1 == color*color. Adjusts dynamic range of env_cubmap. Use higher contrasts to diminish relatively darker areas, increase "hot spots".
"$envmapmask" "texture"
"$envmapmaskscale" float
"$envmapmode" 1
"$envmapsaturation" float
saturation 0 == greyscale 1 == normal
"$envmapsphere" 1
"$envmaptint" "[float float float]"
Scales the red, green, and blue components of the envmap.
"$normalmapalphaenvmapmask" 1
Masks the envmap according to the alpha channel of the normal map.


"$additive" 1
Renders the texture additively (Its colors are added to, instead of replacing, what is displayed behind it).
"$color" "[float float float]"
Scales red, green, and blue components of the material.
"$halflambert" 1
Improves shading quality dramatically.
"$nocull" 1
Make the surface two-sided.
"$selfillum" 1
Uses $basetexture's alpha channel to set minumum clamps on the lighting.


"$translucent" 1
Used with "UnlitGeneric", "VertexlitGeneric", "LightmappedGeneric" and many more shaders to enable a opacity map according to the alpha channel of the "$basetexture" targa.
"$alphatest" 1
Alphatesting: Every pixel with an alpha value less than 178 will be completely transparent ingame. (However, values close to this value will confuse the shader at distances.) This type of shading costs much less than translucent shading [1].
"$alpha" float
Scales material opacity by the 'float' number.


"$decal" 1
Needed for a material to be rendered as a decal. See Creating Decals.
"$model" 1
Used on materials applied to models (used with "UnlitGeneric", "Refract" and others).
"$writeZ" 1
Only used by materials using the modulation shader. Setting $writeZ to 1 forces the material to set the z value in the depth buffer (so things z-buffer against it). By default, the modulation shader doesn't set the z value.

See also