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


From Valve Developer Community
(Redirected from $additive)
Jump to: navigation, search

$translucent is a material shader parameter available in all Source Source games.

English (en)Français (fr)

It specifies that the material should be partially see-through. The alpha channel of the $basetexture is used to decide translucency per-pixel.

Any object that has a $translucent material does not affect VIS, and can be seen through by NPCs from any angle. Visleaves do affect alpha sorting of translucent materials, however.

Note.pngNote:Enabling translucency will completely disable shadows made by projected textures for the texture. Either separate the opaque and solid parts of the texture, or use $alphatest instead.

VMT Syntax Example

$translucent <bool>
	$basetexture glass\window001a
	$translucent 1

Additional Parameters

Add the material's colour values to the existing image, instead of performing a multiplication. This means, among other things, that the material will always brighten the world. This is useful for effects like volumetric dust, light sprites, etc...


Flickering and Reversed Depth

Translucency can sometimes cause a material to flicker, or cause sorting issues with nearby surfaces. In both cases consider using $alphatest instead of $translucent when this happens. It drastically lowers quality, but will usually resolve the issue and is much faster to draw. It will also cast flashlight shadows, unlike translucents.


Unlike $translucent, which allows for varying degrees of opacity, alpha testing does not—portions of your texture are either 'on' or 'off'. $alphatestreference, a normal parameter, controls the filtering of the transparency masking (Using lower values like .01 will result in a more blurred edge while a value of .99 will be extremely sharp.) Since alpha-testing is cheaper than $translucent, this can be used to achieve a similar effect to materials using the $translucent parameter at reduced cost. Using $allowalphatocoverage will enable antialiasing of alpha-tested textures, giving them much softer edges. When $allowAlphaToCoverage is enabled, $alphatestreference is ignored and will not affect the texture's appearance, though it will still affect projected texture stenciling (e.g. the flashlight).

Note.pngNote:The effect of $allowAlphaToCoverage will only be visible if the user has MSAA enabled.
Tip.pngTip:Brush textures on non-detail worldspawn brushes use the BSP tree to improve alpha sorting, reducing the likelihood of this sort of error occurring. Avoid tying simple translucent brushes to func_detail unless necessary; they will not affect VIS regardless.

Compatibility With Other Effects

Certain shader parameters (such as $envmap) disable translucency. If you are having trouble getting it to work, try commenting out other parts of the material.

Note.pngNote:Counter-Strike: Global Offensive Counter-Strike: Global Offensive, Garry's Mod Garry's Mod and Left 4 Dead 2 Left 4 Dead 2 support $envmap with translucency.

Filtering Borders

Wikipedia icon Texture filtering will blend nearby pixels together even if some of of them are entirely transparent. This can create unwanted outlining effects if sudden drop-offs in alpha coincide with drop-offs in colour, which may well happen when the alpha channel reaches zero and you stop being able to see the pixels.

An unwanted filtering border.

To resolve this issue, simply blend the colours of your image slightly beyond where the alpha channel drops off. This can be easily achieved by duplicating the translucent layer and smudging it into the relevant areas.

Fixing filtering borders.
Note.pngNote:This process is called dilation, and also helps with proper generation of mipmaps.

(For users of older versions of GIMP, the program will automatically remove colour information for pixels with an alpha of zero whenever layers are combined. As a work-around for this, you could give those pixels an alpha value of one instead.

As of GIMP 2.8.14, pixels with an alpha value of 0 retain their color information when saved as a tga.

Tip.pngTip:For ports from GoldSrc GoldSrc: xwad will automatically generate proper transparent pixels for any converted WAD textures that contain the { prefix, any converted SPR sprites flagged as AlphaTest, and any converted loose BMP textures that were converted using the -transparent flag.

See also