$vertexcolor and $vertexalpha: Difference between revisions
Jump to navigation
Jump to search
Note:Using a modified StudioMDL and VRAD, it is possible to get user-defined vertex colors on static props.
Bug:$vertexalpha implies $translucent. Materials with $vertexalpha will use the alpha channel of the $basetexture for translucency, in addition to the vertices' alpha, regardless of if $translucent is enabled.
SirYodaJedi (talk | contribs) mNo edit summary |
No edit summary |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 3: | Line 3: | ||
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. | ||
{{note|Using a modified StudioMDL and VRAD, it is | {{note|Using a modified StudioMDL and VRAD, it is possible to get user-defined vertex colors on [[Prop static|static props]].}} | ||
For HUDs in {{ | For HUDs in {{gmod|1}}, the parameter '''<code>$vertexalpha</code>''' is needed in order to make the alpha parameter of <code>[https://wiki.facepunch.com/gmod/surface.SetDrawColor surface.SetDrawColor()]</code> working. | ||
| Line 21: | Line 21: | ||
* Materials with <code>$vertexalpha 1</code> will render as translucent materials and thus suffer from the same sorting issues and caveats as materials with [[$translucent]]. | * Materials with <code>$vertexalpha 1</code> will render as translucent materials and thus suffer from the same sorting issues and caveats as materials with [[$translucent]]. | ||
{{bug|{{mono|$vertexalpha}} implies {{mono|$translucent}}. Materials with {{mono|$vertexalpha}} will use the alpha channel of the {{mono|$basetexture}} for translucency, in addition to the vertices' alpha, regardless of if {{mono|$translucent}} is enabled.}} | {{bug|hidetested=1|{{mono|$vertexalpha}} implies {{mono|$translucent}}. Materials with {{mono|$vertexalpha}} will use the alpha channel of the {{mono|$basetexture}} for translucency, in addition to the vertices' alpha, regardless of if {{mono|$translucent}} is enabled.}} | ||
{{todo|Are these commands shader-agnostic?}} | {{todo|Are these commands shader-agnostic?}} | ||
[[Category:Shader parameters|v]] | [[Category:Shader parameters|v]] | ||
Latest revision as of 22:48, 23 September 2025
$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.
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:
$vertexalphamust be set to 1$vertexcolormust be set to 1 (except onUnlitGeneric)- The surface must be a displacement.
- You can use the "paint alpha" tool to paint the alpha.
There are some additional caveats.
- You can define a second base texture, but it will be invisible.
- Materials with
$vertexalpha 1will render as translucent materials and thus suffer from the same sorting issues and caveats as materials with $translucent.
Todo: Are these commands shader-agnostic?