$translucent: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 1: Line 1:
<div style="float:right;padding:0 1em;background:#FFF;">__TOC__</div>
<div style="float:right;padding:0 1em;background:#FFF;">__TOC__</div>
The [[$translucent]] [[VMT command]] Specifies that the material should use the alpha channel of the [[$basetexture]].VTF to mask transparent sections of the material.


* It is used with [[UnlitGeneric]], [[VertexLitGeneric]], [[LightmappedGeneric]] and many more shaders.
The [[$translucent]] [[VMT command]] Specifies that the material should use the alpha channel of the [[$basetexture]].VTF to mask transparent sections of the material. It is available with [[UnlitGeneric]], [[VertexLitGeneric]], [[LightmappedGeneric]] and many more shaders.


* '''Warning:''' There are [http://www.chatbear.com/board.plm?a=viewthread&t=697,1113959073,6037&id=839735&b=4986&v=flatold reports] of a Rendering bug which reverses the overlay order of multiple translucent materials; so that the further material occludes the nearer one. The preferred solution appears to be to use [[$alphatest]] instead or [[$translucent]].
{{warning|There are reports of a rendering bug which reverses the overlay order of multiple translucent materials; so that the further material occludes the nearer one. The preferred solution appears to be to use [[$alphatest]] instead or [[$translucent]].}}
 
{{note|Per-pixel translucency cannot be used in conjunction with [[$envmap]], and probably other parameters like it. If you have trouble, try stripping away everything non-essential.}}


==VMT syntax example==
==VMT syntax example==
  "[[LightmappedGeneric]]"
  [[LightmappedGeneric]]
  {
  {
     "[[$basetexture]]" "decals/mydecal"
     [[$basetexture]] "decals/mydecal"
     "[[$decal]]" 1
     [[$decal]] 1
     "[[$decalscale]]" 0.10
     [[$decalscale]] 0.10
     "[[$translucent]]" 1
     [[$translucent]] 1
  }
  }


==$additive==
==$additive==
  "$additive" 1
  $additive 1
* Renders the texture additively (Its colors are added to, instead of replacing, what is displayed behind it).  
* Renders the texture additively - its colors are add, instead of replacing, what is displayed behind it.  


==$alpha==
==$alpha==
  "$alpha" <float>
  $alpha <float>
* Scales material opacity by the 'float' number.  
 
* Every pixel with an alpha value less than 178 will be completely transparent in game. However, values close to this value will confuse the shader at distances.(see [[$alphatest]])  
Scales overall material opacity by the 'float' number.
 
Every pixel with an alpha value less than 178 will be completely transparent in game. However, values close to this value will confuse the shader at distances (see [[$alphatest]]).


[[Category:List of Shader Parameters]]
[[Category:List of Shader Parameters]]
[[Category:VMT Transparency]]

Revision as of 09:04, 20 April 2008

The $translucent VMT command Specifies that the material should use the alpha channel of the $basetexture.VTF to mask transparent sections of the material. It is available with UnlitGeneric, VertexLitGeneric, LightmappedGeneric and many more shaders.

Warning.pngWarning:There are reports of a rendering bug which reverses the overlay order of multiple translucent materials; so that the further material occludes the nearer one. The preferred solution appears to be to use $alphatest instead or $translucent.
Note.pngNote:Per-pixel translucency cannot be used in conjunction with $envmap, and probably other parameters like it. If you have trouble, try stripping away everything non-essential.

VMT syntax example

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

$additive

$additive 1
  • Renders the texture additively - its colors are add, instead of replacing, what is displayed behind it.

$alpha

$alpha <float>

Scales overall material opacity by the 'float' number.

Every pixel with an alpha value less than 178 will be completely transparent in game. However, values close to this value will confuse the shader at distances (see $alphatest).