$blendtintbybasealpha: Difference between revisions
(Absolutely no reason to delete, this parameter is very useful for props and having a separate page is indeed completely warranted, like with practically every other material params. It is also usable by itself. This article should be expanded instead.) |
(Illustrated the subject) |
||
Line 7: | Line 7: | ||
The tint mask simply controls the intensity of tinting. The more alpha, the more intense tinting is. | The tint mask simply controls the intensity of tinting. The more alpha, the more intense tinting is. | ||
<gallery mode=nolines widths=300px heights=300px> | |||
File:Blendtint-truck-regular.jpg|Using <code>rendercolor</code> on [[prop physics]] or [[prop dynamic]] entities without <code>$blendtintbybasealpha</code>. The tint is applied across the entire texture, which in this case ins undesireable. | |||
File:Blendtint-truck-enabled.jpg|Same but with <code>$blendtintbybasealpha</code> enabled. The alpha channel of the texture, plus painting the base white, allows the trucks to be tinted in a desireable manner. | |||
</gallery> | |||
<gallery mode=nolines widths=300px heights=300px> | |||
File:Blendtint-truck-textures.jpg|The example texture for the truck. The white base (top) eliminates unwanted color influences, and the alpha channel (bottom) contains the tint mask. | |||
</gallery> | |||
==$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. | '''$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. | ||
[[Category:Shader parameters|b]] | [[Category:Shader parameters|b]] | ||
<gallery mode=nolines widths=300px heights=300px> | |||
File:Blendtint-truck-coloroverbase.jpg|Using <code>$blendtintbybasealpha</code> as above plus <code>$blendtintcoloroverbase</code> at 1.0. The color replacement (instead of tinting) removes texture detail from the masked areas. | |||
File:Blendtint-truck-colorreplacement.jpg|Same but with <code>$color2</code> at <code>"{255 0 0}"</code>. | |||
</gallery> | |||
{{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?}} |
Revision as of 14:49, 9 July 2024
$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 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.


The tint mask simply controls the intensity of tinting. The more alpha, the more intense tinting is.
Using
rendercolor
on prop physics or prop dynamic entities without$blendtintbybasealpha
. The tint is applied across the entire texture, which in this case ins undesireable.
$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.