Modulate: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Re-added forum link until the method to fake vertex coloring/lightmapping with this shader is described (like on the thread))
m (The initial description was misleading, the shader just modulates pixels. How and what you do with it depends on you. Moved it in a tip. (vertex colors is just a SUPER low res (1 pixel covers half a face)) (lightmapping isnt special, just higher res), etc)
Line 1: Line 1:
{{stub}}
{{stub}}
'''<code>Modulate</code>''' is a shader that modulates the colors of any pixels behind it. This can be effectively used to fake various features that [[Source]] may not support, such as vertex coloring or [[lightmap]]ping on models (already possible for [[prop_static]] in {{tf2}}), by creating a surface above the first one to modulate it.
'''<code>Modulate</code>''' is a shader that modulates the colors of any pixels behind it.


[[File:Modulate img.gif|thumb|512px|GIF Animation showing "Modulate" shader in action.]]
[[File:Modulate img.gif|thumb|512px|GIF Animation showing "Modulate" shader in action.]]
Line 7: Line 7:
Accepts only a <code>$basetexture</code> and this texture will be used to modulate pixels. Multiplies the color behind it with this surface's texture.
Accepts only a <code>$basetexture</code> and this texture will be used to modulate pixels. Multiplies the color behind it with this surface's texture.


For a usage tutorial on how to fake vertex coloring or lightmapping, see this [https://forum.facepunch.com/f/mapping/qypk/The-Official-Facepunch-Mapping-WiP-Thread-v17-Carve-Edition/94/ post here] (halfway through the thread).
{{tip|This can be effectively used to fake various features that [[Source]] may not support, such as vertex coloring or [[lightmap]]ping on models, by creating a surface above the first one to modulate it.}}


{{todo|Test performance more. Probably expensive when many layers are in use.}}
{{todo|Test performance more. Probably expensive when many layers are in use.}}

Revision as of 12:21, 28 December 2018

Stub

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

Modulate is a shader that modulates the colors of any pixels behind it.

GIF Animation showing "Modulate" shader in action.

Description

Accepts only a $basetexture and this texture will be used to modulate pixels. Multiplies the color behind it with this surface's texture.

Tip.pngTip:This can be effectively used to fake 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.
Todo: Test performance more. Probably expensive when many layers are in use.

See also