Modulate: Difference between revisions
No edit summary |
SirYodaJedi (talk | contribs) (Practical explanation.) |
||
Line 2: | Line 2: | ||
[[File:Modulate img.gif|thumb|300px|GIF Animation showing "Modulate" shader in action.]] | [[File:Modulate img.gif|thumb|300px|GIF Animation showing "Modulate" shader in action.]] | ||
{{this is a|pixel shader|name=Modulate}} It modulates the colors of any pixels behind it. | {{this is a|pixel shader|name=Modulate}} It modulates the colors of any pixels behind it. | ||
By default, it acts like the "multiply" layer mode in image editors, where full white (#FFFFFF) means no modulation, and darker values will darken what's underneath. If {{code|$mod2x}} is used, it acts like the "overlay" layer mode instead, where 50% grey (#7F7F7F or #808080) means no modulation, and lighter or darker values will lighten or darken what's underneath respectively. | |||
A practical application of this shader is to create [[env_tonemap_controller|bloom-boosting]] textures, to create fake eye adaptation inside interiors. | A practical application of this shader is to create [[env_tonemap_controller|bloom-boosting]] textures, to create fake eye adaptation inside interiors. | ||
Line 11: | Line 13: | ||
Accepts only the following parameters: | Accepts only the following parameters: | ||
{{matParam|$basetexture|texture| | {{matParam|$basetexture|texture|Modulates the color behind it with this surface's texture.}} | ||
{{matParam|$mod2x|boolean|Use [[DecalModulate]] blending instead of multiplication. | {{matParam|$mod2x|boolean|Use [[DecalModulate]] blending instead of multiplication. | ||
:{{codenote |Standard multiplication is equivalent to a BlendFunc of [DestinationColor,Zero], and Mod2x is equivalent to a BlendFunc of [DestinationColor, SourceColor]}} }} | :{{codenote|Standard multiplication is equivalent to a BlendFunc of [DestinationColor,Zero], and Mod2x is equivalent to a BlendFunc of [DestinationColor, SourceColor]}} }} | ||
{{matParam|$nocull|boolean|Apply effect from through both sides of the polygon, instead of only through the front.}} | {{matParam|$nocull|boolean|Apply effect from through both sides of the polygon, instead of only through the front.}} | ||
Revision as of 20:07, 18 April 2025


Modulate
is a Pixel shader available in all Source games. It modulates the colors of any pixels behind it.
By default, it acts like the "multiply" layer mode in image editors, where full white (#FFFFFF) means no modulation, and darker values will darken what's underneath. If $mod2x is used, it acts like the "overlay" layer mode instead, where 50% grey (#7F7F7F or #808080) means no modulation, and lighter or darker values will lighten or darken what's underneath respectively.
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
Accepts only the following parameters:
