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
No edit summary
(→‎In Models: seems to use both?)
 
(38 intermediate revisions by 15 users not shown)
Line 1: Line 1:
The '''<code>[[$surfaceprop]]</code>''' command links the surface of either a [[material]] or [[model]] to a set of physical properties, including:
{{LanguageBar}}
{{this is a|QC command|name=$surfaceprop}}
 
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 sounds are emitted during collisions
Line 5: Line 8:
* Mass, buoyancy, bounciness...
* Mass, buoyancy, bounciness...
* The effect of the surface on nearby sounds (reverberation, echo, absorption...)
* The effect of the surface on nearby sounds (reverberation, echo, absorption...)
{{bug|In {{css|4}}, not including a <code>$surfaceprop</code> 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"}}.}}|only=css|hidetested=1}}


== Syntax ==
== Syntax ==
Line 13: Line 19:


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]].
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 <code>concrete</code>.
{{note|This has been fixed in {{l4d2|2}}.}}|only=l4d|hidetested=1}}
== 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 materials ==
== In Models ==


* <code>$surfaceprop</code> is not linked to any particular [[shader]], so can be used at any time.
* Surface props can be defined for individual [[bone]]s with <code>[[$jointsurfaceprop]]</code>.
* A static prop can only have one $surfaceprop.


== In models ==
{{clarify|It is unclear whether a model's {{cmd|$automass}} is calculated from <code>$surfaceprop</code> or <code>[[Prop Data|prop_data]]</code>. Relevant code is in <tt>[https://github.com/Source-SDK-Archives/source-sdk-2006-ep1/blob/e0b3d19b206ccf3764d851d63963471b30bb5451/utils/studiomdl/collisionmodel.cpp#L590 CJointedModel::ComputeMass()]</tt> in the 2006 SDK.}}


* A model's surface prop will override its material's
== See also ==
* 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>


{{otherlang:en}}
* [[Material surface properties]]
{{otherlang:en:ru|$surfaceprop:ru}}
* {{csgo}} [[List of CS:GO Surface Types]]


[[Category:QC Commands|s]]
[[Category:Shader parameters|surfaceprop]]
[[Category:List of Shader Parameters|S]]

Latest revision as of 14:11, 25 November 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 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".

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.
Note.pngNote:This has been fixed in Left 4 Dead 2 Left 4 Dead 2.

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

  • Surface props can be defined for individual bones with $jointsurfaceprop.
  • A static prop can only have one $surfaceprop.
Clarify: It is unclear whether a model's $automass is calculated from $surfaceprop or prop_data. Relevant code is in CJointedModel::ComputeMass() in the 2006 SDK.

See also