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

$decal: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
The [[$decal]] [[VMT command]] is specifies that the [[$basetexture]] will be projected onto, and clipped into, whatever surface it is applied to.
{{this is a|shader parameter|name=$decal|engine=source}} It offsets any faces assigned the material by a minuscule amount along its [[surface normal]], preventing [[z-fighting]] with coplanar faces. This makes it suitable for [[decals]].
* See [[Creating Decals]].  


==VMT syntax example==
When used on "proper" decals/overlays, as well as brushes and displacements, it disables depth writing{{clarify}}, causing the surface's depth to be inherited from underlying geometry. This can cause a $decal material to look weird when used on a brush/displacement that isn't coplanar or nearly coplanar to a non-$decal brush. If the geometry *is* coplanar, however, this command can be useful for making "[[Decals#brush_decals|pseudo-decals]]", to enable effects that normal decal and overlay entities don't support, such as [[normal map]]ping.
"[[LightmappedGeneric]]"
{{confirm|Does the disabled depth writing also occur for models, or does it just cause the offset there?}}
  {
[[Category:Shader parameters|d]]
    "[[$basetexture]]" "decals/mydecal"
    "[[$decal]]" 1
    "[[$decalscale]]" 0.10
    "[[$translucent]]" 1
}
 
 
 
[[Category:List of Shader Parameters]]
[[Category:VMT Transparency]]

Latest revision as of 11:47, 3 May 2025

$decal is a material shader parameter available in all Source Source games. It offsets any faces assigned the material by a minuscule amount along its surface normal, preventing z-fighting with coplanar faces. This makes it suitable for decals.

When used on "proper" decals/overlays, as well as brushes and displacements, it disables depth writing[Clarify], causing the surface's depth to be inherited from underlying geometry. This can cause a $decal material to look weird when used on a brush/displacement that isn't coplanar or nearly coplanar to a non-$decal brush. If the geometry *is* coplanar, however, this command can be useful for making "pseudo-decals", to enable effects that normal decal and overlay entities don't support, such as normal mapping.

Confirm:Does the disabled depth writing also occur for models, or does it just cause the offset there?