Difference between revisions of "$vertexalpha"

From Valve Developer Community
Jump to: navigation, search
m
(Corrected misinformation and provided more information on how to use this command in conjunction with LightmappedGeneric and UnlitGeneric)
Line 2: Line 2:
  
 
Only [[particle]]s and [[decals]] are known to modify their vertex data, but it should be possible to implement your own scenarios too. Vertex alpha and color ''cannot'' be compiled into a [[model]] however.
 
Only [[particle]]s and [[decals]] are known to modify their vertex data, but it should be possible to implement your own scenarios too. Vertex alpha and color ''cannot'' be compiled into a [[model]] however.
[[LightmappedGeneric]] materials support $vertexalpha, and can be painted on [[Displacements]] using the standard vertex alpha paint tool. This effect is incompatible with $translucent.
 
  
 
Both commands are currently unfunctional in [[Counter-Strike: Global Offensive]]. Using either of the commands will result in the material to turn completely black in-game. Examples are detail props and particles who extensivly used these commands in older versions of the Source Engine, which now cannot use these anymore, resulting in the dissapearance of these entities.
 
Both commands are currently unfunctional in [[Counter-Strike: Global Offensive]]. Using either of the commands will result in the material to turn completely black in-game. Examples are detail props and particles who extensivly used these commands in older versions of the Source Engine, which now cannot use these anymore, resulting in the dissapearance of these entities.
  
 
For HUDs in ''Garry's Mod'', the parameter '''<code>$vertexalpha</code>''' is needed in order to make the alpha parameter of [http://wiki.garrysmod.com/page/surface/SetDrawColor <code>surface.SetDrawColor()</code>] working.
 
For HUDs in ''Garry's Mod'', the parameter '''<code>$vertexalpha</code>''' is needed in order to make the alpha parameter of [http://wiki.garrysmod.com/page/surface/SetDrawColor <code>surface.SetDrawColor()</code>] working.
 +
 +
 +
 +
[[LightmappedGeneric]] and [[UnlitGeneric]] materials support per vertex alpha, however a few conditions must be met.
 +
 +
; <code>[[$vertexalpha]] <[[bool]]></code>
 +
: Must be set to 1
 +
; <code>[[$vertecolor]] <[[bool]]></code>
 +
: Must be set to 1 (This is not necessary on UnlitGeneric)
 +
; The surface must be a displacement.
 +
: You can use the "paint alpha" tool to paint the alpha.
 +
 +
There are some caveats.
 +
: You can define a second base texture, but it will be invisible.
 +
: [[$translucent]] Does not function. The material will continue to use the vertex alpha of the displacement. [[$additive]] however, does function normally
 +
: Material renders as a translucent materials, and as such, suffers from the same sorting issues and caveats as materials with [[$translucent]]
 +
 +
  
 
{{todo|Are these commands shader-agnostic?}}
 
{{todo|Are these commands shader-agnostic?}}
 +
 +
 +
  
 
[[Category:List of Shader Parameters|V]]
 
[[Category:List of Shader Parameters|V]]

Revision as of 18:12, 29 April 2018

$vertexalpha and $vertexcolor are two VMT commands that make the surface derive its alpha and color values from per-vertex data provided by the engine.

Only particles and decals are known to modify their vertex data, but it should be possible to implement your own scenarios too. Vertex alpha and color cannot be compiled into a model however.

Both commands are currently unfunctional in Counter-Strike: Global Offensive. Using either of the commands will result in the material to turn completely black in-game. Examples are detail props and particles who extensivly used these commands in older versions of the Source Engine, which now cannot use these anymore, resulting in the dissapearance of these entities.

For HUDs in Garry's Mod, the parameter $vertexalpha is needed in order to make the alpha parameter of surface.SetDrawColor() working.


LightmappedGeneric and UnlitGeneric materials support per vertex alpha, however a few conditions must be met.

$vertexalpha <bool>
Must be set to 1
$vertecolor <bool>
Must be set to 1 (This is not necessary on UnlitGeneric)
The surface must be a displacement.
You can use the "paint alpha" tool to paint the alpha.

There are some caveats.

You can define a second base texture, but it will be invisible.
$translucent Does not function. The material will continue to use the vertex alpha of the displacement. $additive however, does function normally
Material renders as a translucent materials, and as such, suffers from the same sorting issues and caveats as materials with $translucent


To do: Are these commands shader-agnostic?