This article's documentation is for anything that uses the Source engine. Click here for more information.

$blendtintbybasealpha: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
(this-is-a, plus a bit of extra writing)
Line 1: Line 1:
{{stub}}
{{stub}}
'''$blendtintbybasealpha''' is a [[VMT]] parameter that allows tinting of a mesh's material using the [[$basetexture]]'s [[alpha channel]] as a mask to determine tint '''intensity''' (but ''not'' the tint's [[$color| RGB color]]!) Applying an actual color RGB values is done elsewhere - either in-game or in Hammer with entities using the 'rendercolor' keyvalue. This technique is used in games like ''Left 4 Dead'' to allow for recoloring of the vehicle props, and in ''Team Fortress 2'' for painting hats.
{{this is a|shader parameter|name=$blendtintbybasealpha|since=Left 4 Dead}} It can be used in {{src13|4.1}}.
 
It allows tinting of a model's material using the [[$basetexture]]'s [[alpha channel]] as a mask to determine tint '''intensity''' (but ''not'' the tint's [[$color| RGB color]]!) Applying an actual color RGB values is done elsewhere - either in-game or in Hammer with entities using the 'rendercolor' keyvalue. This technique is used in games like '''Left 4 Dead''' to allow for recoloring of the vehicle props, and in {{tf2|1.bold}} for painting hats.


{{bug|Not compatible with [[$alphatest]] or [[$translucent]], this parameter will override both. Use the [[Modulate]] shader as a workaround.}}
{{bug|Not compatible with [[$alphatest]] or [[$translucent]], this parameter will override both. Use the [[Modulate]] shader as a workaround.}}
{{note|Only compatible with [[VertexLitGeneric]].}}
{{note|Only compatible with [[VertexLitGeneric]].}}


The tint mask simply controls the intensity of tinting. The more alpha, the more intense tinting is.
===Usage===
The tint mask simply controls the intensity of tinting. The more alpha, the more intense tinting is.
 
In practice, it is a good idea to use the mask to avoid tinting parts of the model that aren't covered by paint: either elements like lights, license plates, wheels, warning stripes, or scratched off, rusted or dirty areas, where the paint lost its effect.
 
Alternatively, this method can be used to only paint selected elements, like labels, colored glass, parts of clothing, character hair, makeup and so on.


<gallery mode=nolines widths=300px heights=300px>
<gallery mode=nolines widths=300px heights=300px>
Line 26: Line 33:


{{todo|Explain the practical effect of this in better detail. What's the reason for the black colours? Is this a result of opposite colours mixing?}}
{{todo|Explain the practical effect of this in better detail. What's the reason for the black colours? Is this a result of opposite colours mixing?}}
{{todo|Also explain how this is useful for creating [[skin]]s by manipulating the $color2 in the vmt while reusing the same basetexture.}}

Revision as of 15:06, 9 July 2024

Stub

This article or section is a stub. You can help by expanding it.

$blendtintbybasealpha is a material shader parameter available in all Source Source games since Left 4 Dead Left 4 Dead. It can be used in Source 2013 Source 2013.

It allows tinting of a model's material using the $basetexture's alpha channel as a mask to determine tint intensity (but not the tint's RGB color!) Applying an actual color RGB values is done elsewhere - either in-game or in Hammer with entities using the 'rendercolor' keyvalue. This technique is used in games like Left 4 Dead to allow for recoloring of the vehicle props, and in Team Fortress 2 for painting hats.

Icon-Bug.pngBug:Not compatible with $alphatest or $translucent, this parameter will override both. Use the Modulate shader as a workaround.  [todo tested in ?]
Note.pngNote:Only compatible with VertexLitGeneric.

Usage

The tint mask simply controls the intensity of tinting. The more alpha, the more intense tinting is.

In practice, it is a good idea to use the mask to avoid tinting parts of the model that aren't covered by paint: either elements like lights, license plates, wheels, warning stripes, or scratched off, rusted or dirty areas, where the paint lost its effect.

Alternatively, this method can be used to only paint selected elements, like labels, colored glass, parts of clothing, character hair, makeup and so on.

$blendtintcoloroverbase

$blendtintcoloroverbase, a related parameter, controls the amount of color replacement versus tinting. (replacing the color per pixel entirely, versus adding more color to make the colors closer to the tint RGB color.) A value of '0' will be full tint while a value of '1.00' will replace the albedo in the mask area with the color defined with $color2.

Todo: Explain the practical effect of this in better detail. What's the reason for the black colours? Is this a result of opposite colours mixing?
Todo: Also explain how this is useful for creating skins by manipulating the $color2 in the vmt while reusing the same basetexture.