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

Modulate

From Valve Developer Community
(Redirected from $mod2x)
Jump to navigation Jump to search
English (en)Translate (Translate)
GIF Animation showing "Modulate" shader in action.

Modulate is a Pixel shader available in all Source Source games. It modulates the colors of any pixels behind it.

A practical application of this shader is to create bloom-boosting textures, to create fake eye adaptation inside interiors. Other uses include faking various features that Source may not support, such as vertex coloring or lightmapping on models, by creating a surface above the first one to modulate it.

Description

Comparison of bloom boosting with $mod2x 1 + white basetexture and without
Picture showing the difference between $mod2x 0 and 1.

Accepts only the following parameters:

Multiplies the color behind it with this surface's texture.
Use DecalModulate blending instead of multiplication.
Cpp.pngCode:Standard multiplication is equivalent to a BlendFunc of [DestinationColor,Zero], and Mod2x is equivalent to a BlendFunc of [DestinationColor, SourceColor]
Apply effect from through both sides of the polygon, instead of only through the front.
Note.pngNote:Does not accept any translucency parameters, including $alpha, $alphatest, $additive and $translucent.

See also