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

$surfaceprop: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
(38 intermediate revisions by 16 users not shown)
Line 1: Line 1:
{{stub}}
{{LanguageBar}}
The [[$surfaceprop]] is used to apply a set of surface-collision effects to a Model (as a [[QC command]]) or a Brush Material (as a [[VMT command]]).
{{this is a|QC command|name=$surfaceprop}}
* The basic principle is the same in both cases; the $surfaceprop affects :
:* what sounds it makes when it collides,
:* what particles it emits when shot,
:* what decals it acquires when shot, etc
<!--:* what gibs it throws up if it breaks. // surely this is defined only by propdata or $collisiontext? -->
:* the object's density for physics calculations such as [[$automass]], <!-- confirm this is derived from $surfaceprop and not propdata ? -->


* [[HLMV]] can be used to generate blocks of .QC file that sets the surface properties correctly.
It is also available as a [[shader]] parameter. It links the surface of either a [[material]] or [[model]] to a set of physical properties, including:
* If no $surfaceprop is defined, the "default" surfaceprop (which is something like concrete) is used.
* See also [[$jointsurfaceprop]].
* See also [[propdata]].


==Example Syntax==
* What sounds are emitted during collisions
$surfaceprop "<surfaceproperty_name>"
* What effects are emitted when the surface is shot
where
* Mass, buoyancy, bounciness...
; <surfaceproperty_name>
* The effect of the surface on nearby sounds (reverberation, echo, absorption...)
: is a ''brush'' surface property defined in the <code>/scripts/surfaceproperties.txt</code> file (see [[Material Surface Property]]),
: or a ''model'' surface property defined in the <code>/scripts/surfaceproperties_hl2.txt</code> file.


{{bug|{{css|in}} Not including a $surfaceprop in a vmt for brushes will cause the material to take on the sound (and perhaps the other properties as well) of whatever the last material that was interacted with which did have a $surfaceprop defined.
{{workaround|Use {{mono|$surfaceprop "default"}}.}} }}


== Syntax ==


[[Category:QC Commands|S]]
Syntax is the same for both models and materials:
[[Category:List of Shader Parameters]]
 
[[Category:VMT Common]]
$surfaceprop <name>
 
Names are defined in <code><game>\scripts\surfaceproperties_manifest.txt</code> (and the files it references). For a list of Valve's stock props, see [[Material surface properties]].
{{bug|{{l4d|4}} does not display bullet decals properly on brick surfaces. If you're okay with the decals and visual effects being inappropriate, you can change the <code>$surfaceprop</code> to something else to fix it, such as concrete.{{modernConfirm|Is this fixed in {{l4d2|4}}?}}}}
 
== In Materials ==
 
* <code>$surfaceprop</code> is not linked to any particular [[shader]], so it can be used at any time.
* Only brush based shaders require this parameter. <code>$surfaceprop</code> must always be defined within the collision property of the QC file if anything other than the default is to be used, however.
 
== In Models ==
 
* It is unclear whether a model's mass is calculated from <code>$surfaceprop</code> or <code>[[Prop Data|prop_data]]</code>.
* Surface props can be defined for individual [[bone]]s with <code>[[$jointsurfaceprop]]</code>.
* A static prop can only have one $surfaceprop.
 
== See also ==
 
* [[Material surface properties]]
* {{csgo}} [[List of CS:GO Surface Types]]
 
[[Category:Shader parameters|surfaceprop]]

Latest revision as of 17:52, 3 August 2025

English (en)한국어 (ko)Русский (ru)Translate (Translate)

$surfaceprop is a QC command available in all Source Source games.

It is also available as a shader parameter. It links the surface of either a material or model to a set of physical properties, including:

  • What sounds are emitted during collisions
  • What effects are emitted when the surface is shot
  • Mass, buoyancy, bounciness...
  • The effect of the surface on nearby sounds (reverberation, echo, absorption...)
Icon-Bug.pngBug:(in Counter-Strike: Source) Not including a $surfaceprop in a vmt for brushes will cause the material to take on the sound (and perhaps the other properties as well) of whatever the last material that was interacted with which did have a $surfaceprop defined.
PlacementTip.pngWorkaround:Use $surfaceprop "default".
  [todo tested in ?]

Syntax

Syntax is the same for both models and materials:

$surfaceprop <name>

Names are defined in <game>\scripts\surfaceproperties_manifest.txt (and the files it references). For a list of Valve's stock props, see Material surface properties.

Icon-Bug.pngBug:Left 4 Dead Left 4 Dead does not display bullet decals properly on brick surfaces. If you're okay with the decals and visual effects being inappropriate, you can change the $surfaceprop to something else to fix it, such as concrete.
Confirm:Is this fixed in Left 4 Dead 2 Left 4 Dead 2?
  [todo tested in ?]

In Materials

  • $surfaceprop is not linked to any particular shader, so it can be used at any time.
  • Only brush based shaders require this parameter. $surfaceprop must always be defined within the collision property of the QC file if anything other than the default is to be used, however.

In Models

  • It is unclear whether a model's mass is calculated from $surfaceprop or prop_data.
  • Surface props can be defined for individual bones with $jointsurfaceprop.
  • A static prop can only have one $surfaceprop.

See also