$translucent: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 1: Line 1:
The <code>[[$translucent]]</code> [[VMT command]] specifies Source should use the alpha channel of [[$basetexture]] to mask the material on a pixel-by-pixel basis. It is available with [[UnlitGeneric]], [[VertexLitGeneric]], [[LightmappedGeneric]] and many more shaders.
The <code>[[$translucent]]</code> [[VMT command]] specifies that Source should use the alpha channel of [[$basetexture]] to mask the material on a pixel-by-pixel basis. It is available with [[UnlitGeneric]], [[VertexLitGeneric]], [[LightmappedGeneric]] and many more shaders.


{{warning|<code>$translucent</code> can sometimes cause rendering artefacts; consider [[$alphatest]] when this happens.}}
{{warning|<code>$translucent</code> can sometimes cause rendering artefacts; consider [[$alphatest]] when this happens.}}

Revision as of 11:08, 20 April 2008

The $translucent VMT command specifies that Source should use the alpha channel of $basetexture to mask the material on a pixel-by-pixel basis. It is available with UnlitGeneric, VertexLitGeneric, LightmappedGeneric and many more shaders.

Warning.pngWarning:$translucent can sometimes cause rendering artefacts; consider $alphatest when this happens.
Note.pngNote:$translucent cannot be used in conjunction with $envmap, and probably other parameters like it. If you have trouble, try stripping everything non-essential from your VMT.

VMT syntax example

LightmappedGeneric
{
    $basetexture "decals/mydecal"
    $decal 1
    $decalscale 0.10
    $translucent 1
}

Related parameters

$additive 1
Renders the texture additively - its colors add to, instead of replacing, what is displayed behind.
$alpha <float>
Scales material opacity by the given value. Every pixel with an alpha value less than 178 will be completely transparent in game - but values close to that will confuse the shader at distances (see $alphatest).