$translucent: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
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.
The <code>[[$translucent]]</code> [[VMT]] command specifies that the material should be partially see-through. The [[alpha channel]] of <code>[[$basetexture]]</code> is used to decide translucency per-pixel.


{{warning|<code>$translucent</code> can sometimes cause rendering artefacts; consider [[$alphatest]] when this happens.}}
Any object that has a <code>$translucent</code> material does not affect [[VIS]], and can be seen through by NPCs from any angle.


{{note|<code>$translucent</code> 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.}}
{{tip|Certain shader parameters (such as <code>[[$envmap]]</code>) can disable translucency. If you are having trouble getting it to work, try commenting out other parts of the material.}}
 
{{warning|<code>$translucent</code> can sometimes cause rendering artefacts. Consider <code>[[#$alphatest|$alphatest]]</code> when this happens.}}


==VMT syntax example==
==VMT syntax example==
$translucent <[[bool]]>


  [[LightmappedGeneric]]
  [[LightmappedGeneric]]
  {
  {
    [[$basetexture]] "decals/mydecal"
[[$basetexture]] glass\window001a
    [[$decal]] 1
'''$translucent 1'''
    [[$decalscale]] 0.10
    [[$translucent]] 1
  }
  }


==Related parameters==
==Additional parameters==
 
;<code>$additive <bool></code>
:Renders the texture additively, so that its colors add to, instead of replacing, what is displayed behind.
 
== $alphatest ==
'''<code>$alphatest</code>''' enables low-detail translucency if used instead of <code>$translucent</code>. This drastically lowers quality, but is much faster to draw and can resolve 'flickering' artefacts.
 
== See also ==


;<code>$additive 1</code>
*<code>[[$alpha]]</code>, for texture-wide translucency.
:Renders the texture additively - its colors add to, instead of replacing, what is displayed behind.
;<code>$alpha <[[float]]></code>
:Scales overall 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]]).


[[Category:List of Shader Parameters]]
[[Category:List of Shader Parameters|T]]
[[Category:VMT Transparency]]
[[Category:VMT Transparency]]
__NOTOC__

Revision as of 04:16, 13 July 2008

The $translucent VMT command specifies that the material should be partially see-through. The alpha channel of $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.

Tip.pngTip:Certain shader parameters (such as $envmap) can disable translucency. If you are having trouble getting it to work, try commenting out other parts of the material.
Warning.pngWarning:$translucent can sometimes cause rendering artefacts. Consider $alphatest when this happens.

VMT syntax example

$translucent <bool>
LightmappedGeneric
{
	$basetexture glass\window001a
	$translucent 1
}

Additional parameters

$additive <bool>
Renders the texture additively, so that its colors add to, instead of replacing, what is displayed behind.

$alphatest

$alphatest enables low-detail translucency if used instead of $translucent. This drastically lowers quality, but is much faster to draw and can resolve 'flickering' artefacts.

See also

  • $alpha, for texture-wide translucency.