$additive: Difference between revisions
(Replaced the redirect with its own article, will work on it more) Tag: Removed redirect |
SirYodaJedi (talk | contribs) |
||
(10 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{LanguageBar}} | {{LanguageBar}}{{toc-right}} | ||
{{this is a|shader parameter|name=$additive | [[File:additive_brush.jpg|240px|thumb|right|A world [[brush]] with additive material applied.]] | ||
[[File:additive_model.jpg|240px|thumb|right|A model with additive material. Note that, when used as a [[prop_static]], [[VRAD]] still creates a shadow for it, not accounting for $additive.]] | |||
{{this is a|shader parameter|name=$additive}} | |||
It specifies that the material should be rendered additively; that is, its colour values will be added to underlying pixels. This means, among other things, that the material will always brighten the world behind it. This is useful for effects like volumetric dust, light sprites, etc. | It specifies that the material should be rendered additively; that is, its colour values will be added to underlying pixels. This means, among other things, that the material will always brighten the world behind it. This is useful for effects like volumetric dust, light sprites, etc. | ||
{{note| | {{note|Additive blending is a form of transparency, and [[Solid|solids]] with $additive materials on them cannot be used to [[seal]] the map.}} | ||
==VMT Syntax Example== | ==VMT Syntax Example== | ||
Line 19: | Line 21: | ||
$additive is supported by most shaders, and does not require the texture to have an [[alpha]] channel. It also doesn't share the numerous caveats of [[$translucent]] and [[$alphatest]], such as being mutually exclusive with [[$selfillum]], or other shader parameters that make use of the alpha channel, for that matter. | $additive is supported by most shaders, and does not require the texture to have an [[alpha]] channel. It also doesn't share the numerous caveats of [[$translucent]] and [[$alphatest]], such as being mutually exclusive with [[$selfillum]], or other shader parameters that make use of the alpha channel, for that matter. | ||
== Caveats == | |||
=== Flickering and reversed depth === | |||
Additive blending suffers from similar alpha sorting issues as regular alpha blended translucency ([[$translucent]], [[$alpha]], etc.). Unlike regular alpha blending, however, ''additive-blended surfaces will always blend correctly with other additive-blended surfaces''. This makes them particularly useful for [[particle]] effects, which often involve stacked translucency. | |||
=== Texture shadows === | |||
[[VRAD]] creates textures shadows for static props exclusively using the [[alpha]] channel of the [[$basetexture]] of materials containing [[$translucent]] and [[$alphatest]]. As additive blending doesn't use the alpha channel, VRAD will treat additive-blended surfaces as being opaque. | |||
{{workaround|Do one of the following: | |||
* {{only|{{gmod}}{{mapbase}}}} Use {{cmd|%alphatexture}}. | |||
* Create an alpha channel and add [[$translucent]] ([[$additive]] will be prioritized in-game). | |||
* Use the [[RAD_file#Source_1|noshadow RAD file command]]. | |||
}} | |||
==See also== | ==See also== |
Latest revision as of 08:21, 4 August 2025




$additive
is a material shader parameter available in all Source games.
It specifies that the material should be rendered additively; that is, its colour values will be added to underlying pixels. This means, among other things, that the material will always brighten the world behind it. This is useful for effects like volumetric dust, light sprites, etc.

VMT Syntax Example
$additive <bool>
LightmappedGeneric { $basetexture glass\window001a $additive 1 }
The amount of brightening depends on the brightness of the $basetexture. A fully black texture will become invisible, however, other texture effects (such as $detail, $emissiveblend, $envmap) can still be drawn (not implicitly additively).
This does work together with $color and $color2, allowing to control the strength of the additive blending, and change it with Proxies.
$additive is supported by most shaders, and does not require the texture to have an alpha channel. It also doesn't share the numerous caveats of $translucent and $alphatest, such as being mutually exclusive with $selfillum, or other shader parameters that make use of the alpha channel, for that matter.
Caveats
Flickering and reversed depth
Additive blending suffers from similar alpha sorting issues as regular alpha blended translucency ($translucent, $alpha, etc.). Unlike regular alpha blending, however, additive-blended surfaces will always blend correctly with other additive-blended surfaces. This makes them particularly useful for particle effects, which often involve stacked translucency.
Texture shadows
VRAD creates textures shadows for static props exclusively using the alpha channel of the $basetexture of materials containing $translucent and $alphatest. As additive blending doesn't use the alpha channel, VRAD will treat additive-blended surfaces as being opaque.

- (only in
) Use %alphatexture.
- Create an alpha channel and add $translucent ($additive will be prioritized in-game).
- Use the noshadow RAD file command.
See also
- $translucent
- $alpha, for texture-wide translucency
- $distancealpha, for vector-like alpha edges
- $vertexalpha
- $alphatest, for binary opacity.