Detail props: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
(finished rewrite)
Line 1: Line 1:
[[File:Dear-esther henge.jpg|thumb|Detail props create the foliage in this screenshot from [[Dear Esther]].]]
[[File:Dear-esther henge.jpg|thumb|Detail props create the foliage in this screenshot from [[Dear Esther]].]]


'''Detail props''' are cheap, non-solid 3D objects that randomly emit from [[material]]s. They fade out at a distance (by default 1200 [[unit]]s), so are only good for small, surface-hugging features like grass tufts.
'''Detail props''' are cheap, non-solid objects that randomly emit from [[material]]s. They fade out at a distance (by default 1200 [[unit]]s), so are only good for small, surface-hugging features like grass and shrubs.


They generally take the form of "quads": two polygons forming a square, on which a [[$translucent]] material is applied. The prop can be configured to rotate so that it always faces the camera. While it is technically possible to use actual [[model]]s as detail props, there is a significant DirectX overhead involved (Source does not support [[Wikipedia:Geometry instancing|Geometry instancing]]) that makes doing so impractical.
There are two types of detail prop:


Detail props can be configured to sway in the breeze, and to bend as players brush past.
; [[Sprite]]
: Two [[polygon]]s forming a square, covered with a [[$translucent]] material. The prop can be configured to rotate so that it always faces the camera, to sway in the breeze, and/or to bend as players brush past.
; [[Model]]
: Although supported, there is a significant per-model DirectX overhead (Source does not support [[Wikipedia:Geometry instancing|geometry instancing]]) that makes them some ten times slower than sprites.


== Usage ==
== Usage ==


"Detail groups" are defined in a .VBSP (an ANSI text file), then referenced with the material parameter '''<code>%detailtype</code>'''. VBSP generates detail props randomly when the map is compiled.
Types of detail prop cover ("detail types") are defined in a .VBSP script file (ANSI format), then referenced in materials with the '''<code>%detailtype</code>''' parameter. [[VBSP]] then generates detail props on the material randomly when the map is compiled.


The default .VBSP file is <code>root\detail.vbsp</code>, but you can create your own as long as you remember to change the corresponding [[worldspawn]] setting (Map > Map Properties...).
Detail props can be placed manually with the [[prop_detail]] entity, but it only supports models so is rarely used.


== Stock detail groups ==
{{tip|The default .VBSP file is <code>root\detail.vbsp</code>, but you can create your own as long as you remember to change the corresponding [[worldspawn]] setting (Map > Map Properties...). See [[#New detail types]].}}


These groups are available in [[Source SDK Base]]:
== Stock detail types==
 
These types are available in [[Source SDK Base]]:


* swamp_land_002
* swamp_land_002
Line 37: Line 42:
{{todo|Screenshots}}
{{todo|Screenshots}}


These groups are present but rely on unavailable models:
These types are present but rely on unavailable models:


* swamp_land_001
* swamp_land_001
Line 49: Line 54:
* street_junk
* street_junk


== New detail groups ==
== New detail types==


Here is a simple .VBSP file:
Here is a custom .VBSP file (use [[:File:Detail forest.png|this detail texture]] with it):


<source lang=ini>
<div style="max-height:30em;overflow:auto;"><source lang=ini>
detail
detail
{
{
redgrass
forest_floor_01
{
{
density 2000
density 1600


Group1
GrassTex
{
{
alpha 1
alpha 0
 
RoseFlower
Model1
{
sprite "0 0 83 128 512"
spritesize "0.5 0.05 7 13"
spriterandomscale .3
amount 0.02
// sprite_shape cross
detailorientation 2
sway 0.2
upright 1
}
FernShrub
{
sprite "120 0 136 256 512"
spritesize "0.5 0.05 17 28"
spriterandomscale .15
amount 0.03
sprite_shape tri
shape_size 0
sway 0.3
}
GrassTuft
{
{
sprite "288 0 128 128 512"
sprite "0 199 120 57 512"
spritesize ".5 0 19 25"
spritesize "0.5 0 20 10"
spriterandomscale .2
spriterandomscale .2
amount .4
amount .6
detailOrientation 2
sprite_shape cross
sway .1
}
}
Model2
PinkFlower
{
{
sprite "0 0 128 128 512"
sprite "83 0 38 128 512"
spritesize ".5 0 23 30"
spritesize "0.5 0 6 18"
spriterandomscale .2
spriterandomscale .1
amount .4
amount 0.02
detailOrientation 2
detailorientation 2
sway 0.3
upright 0
}
}
Model3
LushShrub
{
{
sprite "144 0 128 128 512"
sprite "256 128 172 128 512"
spritesize ".5 0 15 15"
spritesize "0.5 0 32 21"
spriterandomscale .2
spriterandomscale .3
amount .2
amount 0.01
detailOrientation 2
sprite_shape tri
shape_size 0.1
sway 0.1
}
}
}
}
 
LeavesTex
Group2
{
{
alpha 0
alpha 1
DriedGrass
{
sprite "256 0 92 120 512"
spritesize "0.5 0 13 17"
spriterandomscale .15
amount .3
sprite_shape cross
sway .3
}
LushGrass
{
sprite "0 199 120 57 512"
spritesize "0.5 0 20 10"
spriterandomscale .2
amount .6
sprite_shape cross
sway .1
}
RoseFlower
{
sprite "0 0 83 128 512"
spritesize "0.5 0.05 7 13"
spriterandomscale .3
amount 0.01
detailorientation 2
sway 0.2
}
}
}
}
second_detail_group
{
// ...
}
}
}
}
</source>
</source></div>


; <code>density</code>
The syntax is:
: How frequently to generate a prop. {{todo|What's the equation?}}
; <code>Group<n></code>
: You can group detail props together ''within'' the detail group. This lets you apply properties to many of them at once.
; <code>alpha</code>
: This does not define the alpha value of the detail prop, but instead the [[displacement]] alpha value at which the current subgroup has 100% influence. (Detail groups are most often used with <code>[[WorldVertexTransition]]</code> materials.)
: Group2, further down in the example, is empty except for the command <code>alpha 0</code>. This means that the detail group will produce lots of props at alpha 1 and then smoothly degrade into nothing in regions with alpha 0 (i.e. the second <code>WVT</code> texture).
; <code>Model<n></code>
: Defines an individual detail prop, regardless of whether it's a model or a quad.


Then, you can specify as many groups of detail props as you like. Materials on non-displacement surfaces will only use one group, but [[displacement]] surfaces may use multiple groups. Each group specifies a list of the models that will be randomly emitted. The <code>model</code> fields above describe which studio model to use, and the <code>"amount"</code> field describes how many to emit relative to the other models in the list. For advanced users: If the amounts of all the models within a single group add up to less than 1, then the system will actually emit less than the maximum number of models described by <code>"density"</code>.
<source lang=ini>
detail
{
<Detail type>
{
density <float>


The <code>"alpha"</code> field is only used for displacement surfaces. When a displacement surface is using a material that blends between two [[texture]]s, the alpha describes how much of each texture to use. The detail system looks at that alpha to choose which group to select models from. For example, lets say you've got a displacement with two textures on it, one is road (<code>alpha = 1</code> for the road) and the other is grass (alpha = 0 for the grass). In the example above, it would emit rocks on the road and grass tufts on the grass, since the group with <code>"alpha" "1.0"</code> contains rock models and the group with <code>"alpha" "0.0"</code> contains grass models. Note that you can make as many groups as you want; for example, if you were to add a group with <code>"alpha" "0.5"</code>, this would create detail props using that group's models wherever the displacement is blending halfway between the rocks and grass.
<Group>
{
alpha <normal>


Using the detail prop system with .MDLs can actually be fairly expensive owing to a high per-model overhead that currently exists in DirectX. To avoid this, you may also use sprites with the detail prop system, which doesn't have this overhead and is consequently at least 10x faster than using .MDLs. Here's how to specify a detail model group that uses detail sprites:
<Prop>
 
{
<pre>
<settings>
Group1
}
{
}
"alpha" "1"
Model1
{
"sprite" "288 0 128 128 512"
"spritesize" "0.5 0.0 19 25"
"spriterandomscale" "0.2"
"amount" "0.2"
"detailOrientation" "2"
}
}
Model2
{
"sprite" "0 0 128 128 512"
"spritesize" "0.5 0.0 23 30"
"spriterandomscale" "0.2"
"amount" "0.1"
"detailOrientation" "2"
}
}
}
</pre>
</source>
 
The textures for detail sprites must all be placed in sub-regions of the texture <code>"materials\detail\detailsprites.vtf"</code>.
 
The first two numbers in the <code>"sprite"</code> field shown above specify the (X, Y) coordinate of the upper left corner of the sprite as it lies within the <code>detailsprite.vtf</code> texture. The next two numbers specify the width and height of the sprite. The final number is the size of the detailsprite.vtf texture in pixels.
 
The first two numbers in the <code>"spritesize"</code> line specifies the rotational center of the detail sprite in normalized coordinates: (0,0) specifies the lower left, and (1,1) specifies the upper right. In the example above, the rotational center of the sprite is halfway along the lower edge of the sprite. The final two numbers in the <code>"spritesize"</code> line indicate the width and height of the sprite in world units when it gets drawn.
 
<code>"spriterandomscale"</code> specifies a random amount to scale the width and height of the detail sprite (in the example, the sprite will be between 80% and 120% of the size indicated in the <code>"spritesize"</code> line).
 
Finally, <code>"detailOrientation"</code> specifies how the detail sprite will move. A value of 0 indicates that it will not rotate; 1 means that it will always face the camera, and 2 means it will rotate around its Z-axis to try to face the camera as best it can.
 
===General Properties===
{| class=standard-table
!width="100"|Property
!Comment
|-
| <code>"density"</code> || Specifies how many points to randomly generate. Larger numbers will generate more detail props.
|-
| <code>"amount"</code> || The ratio of a detail relative to the others in the group.
'''Value''': 0.0 => 1.0
|-
| <code>"alpha"</code> || Determines which alpha to use for blended displacement surfaces. <code>0.5</code> would be between the two textures.
'''Value''':0.0 => 1.0
|}
 
===Properties Specific to Sprites===
{| class=standard-table
!width="100"|Property
!Comment
|-
| <code>"sprite"</code> || Specifies the sprite to use by selecting a region of <code>[[detailsprites.vtf]]</code>. The first two numbers specify the (X, Y) coordinate of the upper left corner of the sprite as it lies within the detailsprite.vtf texture. The next two numbers specify the width and height of the sprite. The final number is the size of the detailsprite.vtf texture in pixels.
|-
| <code>"spritesize"</code> || The first two numbers specify the rotational center of the detail sprite in normalized coordinates: (0,0) specifies the lower left, and (1,1) specifies the upper right (0.5, 0.0 usually suffice). The final two numbers in the "spritesize" line indicate the width and height of the sprite in world units when it gets drawn.
|-
| <code>"spriterandomscale"</code> || Specifies a random amount by which the sprite's size is scaled.
|-
| <code>"detailOrientation"</code> || '''0''': Do not orient towards the player.
'''1''': Always face the player.


'''2''': Always face the player but rotate on the x and y axis only.
The commands are:
|}


===Properties Specific to Models===
; Detail type
{| class=standard-table
: The name for use in <code>%detailtype</code>.
!width="100"|Property
:; <code>density <[[float]]></code>
!Comment
:: How frequently to generate detail props on surfaces using this type. {{todo|What's the equation?}}
|-
; Group
| <code>"model"</code> || Specifies which studio model to use.
: Even if you are only defining one detail prop, you must create a group. The name doesn't seem to be used anywhere; it's just for reference.
|}
:; <code>alpha <[[normal]]></code>
:: The [[displacement]] alpha value on which the current prop group is generated. If <code>alpha</code> is undefined, all groups will appear in all areas. {{note|Non-displacement surfaces use only the first detail group!}}
; Prop
: Defines a detail prop. Although uniquely named, there is no way to reference an existing prop later on in the .VBSP: it must be redefined every time it's needed. It's still a good idea to use descriptive names, though!


=Detail Shapes=
=== Prop settings ===


Detail shapes are a new way for the engine to place auto-emitted '''detail props''' on a surface, as specified by the [[detail.vbsp]] file. Introduced in the [[Day of Defeat: Source]] release, '''detail shapes''' allow normal sprites to be placed in a variety of shapes.
; <code>amount <[[normal]]></code>
: The proportion of the group that this model (or sprite) will account for. If the <code>amount</code> values of a group add up to less than 1, fewer detail props will be emitted than specified by <code>density</code>.
; <code>model <[[string]]></code>
: A [[model]] to use. Include <code>\models</code> in the path. {{todo|How to compile a detail model.}} {{note|If this is used, there is no need for any of the following commands (which all apply to sprites).}} {{warning|Performance when using models is appauling!}}
; <code>sprite <[[int]]|X, Y, W, H, VTF width></code>
: The subregion of the map's detail material to use for this prop.
:* X/Y are the top-left position
:* W/H are the dimensions of the prop in [[texel]]s
:* VTF width is the X-axis resolution of the whole detail texture. {{note|The texture must be at a 2:1 aspect ratio!}}
; <code>spritesize <normal|U, V> <float|W, H></code>
: The origin (U/V) and size in [[unit]]s (W/H) of the sprite when it is in the world.
; <code>spriterandomscale <normal></code>
: The sprite's size will vary from 100% by this degree. A value of 1 means that the sprite could be generated at anything between 0% and 200% of its normal size.
; <code>detailOrientation <int></code>
: How the sprite will react to the camera:
:* 0: It will not rotate.
:* 1: It will rotate around its origin to always face the camera head-on
:* 2: It will rotate around its Z-axis only to face the camera. This is the most common setting, as it foreshortens the sprite while keeping it otherwise head-on.


In addition, sprites can now have a "swaying" motion, where the sprite ''leans'' forward and back.
==== Shapes ====


Finally, these sprites are capable of being "displaced". That is, they will move away from players upon contact and then bounce back to their original orientation. Note that the sprites will continue to "sway" even when pushed out of their original position.
Shapes are advanced sprites which can deform. This is used to create a "swaying in the breeze" effect, and to make them bend away from intersecting players.


==Usage==
{{note|Detail shapes are only available in [[Day of Defeat: Source]], [[Counter-Strike: Source]] and the SDK source code. To enable them in your mod, either compile with <code>SDK_DLL</code> or open <code>\game\client\detailobjectsystem.cpp</code> and remove the <code>#ifdef</code> from line 27.}}
Detail shape functionality was added (silently) to Counter-Strike: Source with the HDR update on December 1, 2005, which indicates that this addition is linked to the HDR technology and thus will likely be added to the other Source games when they are updated with HDR.


==Types of Detail Shapes==
If you try to create a shapes in a game without support for them, no detail props will be created.
[[Image:detail shape tri.jpg|thumb|200px|left|Detail shape of "tri"]]
[[Image:detail shape cross.jpg|thumb|200px|right|Another "tri" with a small distance value]]
{| class=standard-table
! sprite_shape || Comment
|-
| <code>"cross"</code> || This makes a criss-cross shape.
<br>
Places two sprites which cross over one-another in the middle.
|-
| <code>"tri"</code> || This makes a detail in the exploded prism shape (triangle).
<br>
Places three sprites sitting equidistant from each other in a triangle formation.
|}
<br style="clear:both;">


==Refining Detail Shapes==
; <code>sprite_shape <choices></code>
: Creates a set of sprites at different angles, allowing for a pseudo-3D effect.
:; <code>tri</code>
:: [[File:Detail shape tri.jpg|thumb|<code>sprite_shape tri</code>]] Three sprites sitting equidistant from each other in a triangle formation.
:; <code>cross</code>
:: Two sprites which cross over one another in the middle.
; <code>sway <[[normal]]></code>
: Percentage of <code>cl_detail_max_sway</code> that the prop bends to. {{tip|The prop don't need a <code>sprite_shape</code> to sway, but you ''do'' need shapes support in your game.}}
; <code>shape_angle <[[float]]></code>
: ''sprite_shape tri only.'' Number of degrees outward at which to angle the individual sprites. Unfortunately it is not possible to angle inward, for some reason! Useful range is 0-45&deg;.
; <code>shape_size <normal></code>
: ''sprite_shape tri only.'' Percentage of the sprites' width to put between them and the centre of the triangle. 0 means that the sprites cross at the prop's origin.


There are several properties for the detail.vbsp file which refine the shape of the detail sprites, as well as enhacing their aesthetic quality (such as the sway).
There are several console commands which affect shapes:


; <code>cl_detail_avoid_force</code>
: Force with which to avoid players.
; <code>cl_detail_avoid_radius</code>
: Radius around sprite to avoid players.
; <code>cl_detail_avoid_recover_speed</code>
: How fast to recover position after avoiding players.
; <code>cl_detail_max_sway</code>
: Amplitude of the detail prop sway.


{| class=standard-table
If you can't find these, then your game doesn't have detail shape support.
! Property || Comment
|-
| <code>"sway"</code> || Percentage of ''cl_detail_max_sway'' ( default 5 ).
<br>
'''Value''': 0.0 => 1.0
|-
| <code>"shape_angle"</code> || ''Specific to "tri" shape''. Degrees to angle out each of the leaves.
<br>
'''Value''': 0 => 90 (Untested)
|-
| <code>"shape_size"</code> || ''Specific to "tri" shape''. Percentage of sprite width to separate each leaf. near 0 for a triangle shape, near 1 for a closer, criss-cross shape.
<br>
'''Value''': 0, 1 (Untested)
|}


==Related Console Commands==
== New detail materials ==


There are several clientside [[console]] commands you may use to alter the behavior of detail sprites.
[[File:Detail forest.png|thumb|The [[#New detail types|sample .VBSP]]'s detail texture.]]


There are a few hoops to jump through when creating new detail sprite materials:


{| class=standard-table
* The texture must be 2:1. If it is 512 pixels across it must be 256 pixels tall.
! Command || Comment
* Leave at least a one-pixel gap between subregions, or you may find parts of one sprite bleeding over into the next.
|-
* The material must be <code>[[UnlitGeneric]]</code>. You'll probably want to use the [[$vertexcolor]], [[$receiveflashlight]], [[$nocull]] and [[$translucent]] parameters too.
| <code>"cl_detail_avoid_force"</code> || Force with which to avoid players.
* Unless you are overwriting <code>detail\detailsprites.vmt</code>, mappers must remember to select the correct material in ''Map > Map Properties...''.
|-
| <code>"cl_detail_avoid_radius"</code> || Radius around sprite to avoid players.
|-
| <code>"cl_detail_avoid_recover_speed"</code> || How fast to recover position after avoiding players.
|-
| <code>"cl_detail_max_sway"</code> || Amplitude of the detail prop sway.
|}


[[Category:Level Design]]
[[Category:Level Design]]

Revision as of 15:08, 12 November 2009

Detail props create the foliage in this screenshot from Dear Esther.

Detail props are cheap, non-solid objects that randomly emit from materials. They fade out at a distance (by default 1200 units), so are only good for small, surface-hugging features like grass and shrubs.

There are two types of detail prop:

Sprite
Two polygons forming a square, covered with a $translucent material. The prop can be configured to rotate so that it always faces the camera, to sway in the breeze, and/or to bend as players brush past.
Model
Although supported, there is a significant per-model DirectX overhead (Source does not support geometry instancing) that makes them some ten times slower than sprites.

Usage

Types of detail prop cover ("detail types") are defined in a .VBSP script file (ANSI format), then referenced in materials with the %detailtype parameter. VBSP then generates detail props on the material randomly when the map is compiled.

Detail props can be placed manually with the prop_detail entity, but it only supports models so is rarely used.

Tip.pngTip:The default .VBSP file is root\detail.vbsp, but you can create your own as long as you remember to change the corresponding worldspawn setting (Map > Map Properties...). See #New detail types.

Stock detail types

These types are available in Source SDK Base:

  • swamp_land_002
  • grass01
  • grass02
  • coastline_grass01
  • coastline_grass02
  • coastline_redgrass01
  • coastline_redgrass02
  • coastline_redgrass03
  • citygrass01
  • redgrass
  • redgrass_light
  • short_redgrass
  • PerfTest1
  • canal_reeds
  • rocks_redgrass
  • lostcoast_grass
  • lostcoast_grass2
Todo: Screenshots

These types are present but rely on unavailable models:

  • swamp_land_001
  • swamp_water_001
  • grassland1
  • grassland2
  • grassland3
  • rocks3
  • test
  • coast_pebbles
  • street_junk

New detail types

Here is a custom .VBSP file (use this detail texture with it):

detail
{
	forest_floor_01
	{
		density 1600

		GrassTex
		{
			alpha 0
			RoseFlower
			{
				sprite "0 0 83 128 512"
				spritesize "0.5 0.05 7 13"
				spriterandomscale .3
				amount 0.02
			//	sprite_shape cross
				detailorientation 2
				sway 0.2
				upright 1
			}
			FernShrub
			{
				sprite "120 0 136 256 512"
				spritesize "0.5 0.05 17 28"
				spriterandomscale .15
				amount 0.03
				sprite_shape tri
				shape_size 0
				sway 0.3
			}
			GrassTuft
			{
				sprite "0 199 120 57 512"
				spritesize "0.5 0 20 10"
				spriterandomscale .2
				amount .6
				sprite_shape cross
				sway .1
			}
			PinkFlower
			{
				sprite "83 0 38 128 512"
				spritesize "0.5 0 6 18"
				spriterandomscale .1
				amount 0.02
				detailorientation 2
				sway 0.3
				upright 0
			}
			LushShrub
			{
				sprite "256 128 172 128 512"
				spritesize "0.5 0 32 21"
				spriterandomscale .3
				amount 0.01
				sprite_shape tri
				shape_size 0.1
				sway 0.1
			}
		}
		LeavesTex
		{
			alpha 1
			DriedGrass
			{
				sprite "256 0 92 120 512"
				spritesize "0.5 0 13 17"
				spriterandomscale .15
				amount .3
				sprite_shape cross
				sway .3
			}
			LushGrass
			{
				sprite "0 199 120 57 512"
				spritesize "0.5 0 20 10"
				spriterandomscale .2
				amount .6
				sprite_shape cross
				sway .1
			}
			RoseFlower
			{
				sprite "0 0 83 128 512"
				spritesize "0.5 0.05 7 13"
				spriterandomscale .3
				amount 0.01
				detailorientation 2
				sway 0.2
			}
		}
	}
}

The syntax is:

detail
{
	<Detail type>
	{
		density <float>

		<Group>
		{
			alpha <normal>

			<Prop>
			{
				<settings>
			}
		}
	}
}

The commands are:

Detail type
The name for use in %detailtype.
density <float>
How frequently to generate detail props on surfaces using this type.
Todo: What's the equation?
Group
Even if you are only defining one detail prop, you must create a group. The name doesn't seem to be used anywhere; it's just for reference.
alpha <normal>
The displacement alpha value on which the current prop group is generated. If alpha is undefined, all groups will appear in all areas.
Note.pngNote:Non-displacement surfaces use only the first detail group!
Prop
Defines a detail prop. Although uniquely named, there is no way to reference an existing prop later on in the .VBSP: it must be redefined every time it's needed. It's still a good idea to use descriptive names, though!

Prop settings

amount <normal>
The proportion of the group that this model (or sprite) will account for. If the amount values of a group add up to less than 1, fewer detail props will be emitted than specified by density.
model <string>
A model to use. Include \models in the path.
Todo: How to compile a detail model.
Note.pngNote:If this is used, there is no need for any of the following commands (which all apply to sprites).
Warning.pngWarning:Performance when using models is appauling!
sprite <int|X, Y, W, H, VTF width>
The subregion of the map's detail material to use for this prop.
  • X/Y are the top-left position
  • W/H are the dimensions of the prop in texels
  • VTF width is the X-axis resolution of the whole detail texture.
    Note.pngNote:The texture must be at a 2:1 aspect ratio!
spritesize <normal|U, V> <float|W, H>
The origin (U/V) and size in units (W/H) of the sprite when it is in the world.
spriterandomscale <normal>
The sprite's size will vary from 100% by this degree. A value of 1 means that the sprite could be generated at anything between 0% and 200% of its normal size.
detailOrientation <int>
How the sprite will react to the camera:
  • 0: It will not rotate.
  • 1: It will rotate around its origin to always face the camera head-on
  • 2: It will rotate around its Z-axis only to face the camera. This is the most common setting, as it foreshortens the sprite while keeping it otherwise head-on.

Shapes

Shapes are advanced sprites which can deform. This is used to create a "swaying in the breeze" effect, and to make them bend away from intersecting players.

Note.pngNote:Detail shapes are only available in Day of Defeat: Source, Counter-Strike: Source and the SDK source code. To enable them in your mod, either compile with SDK_DLL or open \game\client\detailobjectsystem.cpp and remove the #ifdef from line 27.

If you try to create a shapes in a game without support for them, no detail props will be created.

sprite_shape <choices>
Creates a set of sprites at different angles, allowing for a pseudo-3D effect.
tri
sprite_shape tri
Three sprites sitting equidistant from each other in a triangle formation.
cross
Two sprites which cross over one another in the middle.
sway <normal>
Percentage of cl_detail_max_sway that the prop bends to.
Tip.pngTip:The prop don't need a sprite_shape to sway, but you do need shapes support in your game.
shape_angle <float>
sprite_shape tri only. Number of degrees outward at which to angle the individual sprites. Unfortunately it is not possible to angle inward, for some reason! Useful range is 0-45°.
shape_size <normal>
sprite_shape tri only. Percentage of the sprites' width to put between them and the centre of the triangle. 0 means that the sprites cross at the prop's origin.

There are several console commands which affect shapes:

cl_detail_avoid_force
Force with which to avoid players.
cl_detail_avoid_radius
Radius around sprite to avoid players.
cl_detail_avoid_recover_speed
How fast to recover position after avoiding players.
cl_detail_max_sway
Amplitude of the detail prop sway.

If you can't find these, then your game doesn't have detail shape support.

New detail materials

The sample .VBSP's detail texture.

There are a few hoops to jump through when creating new detail sprite materials:

  • The texture must be 2:1. If it is 512 pixels across it must be 256 pixels tall.
  • Leave at least a one-pixel gap between subregions, or you may find parts of one sprite bleeding over into the next.
  • The material must be UnlitGeneric. You'll probably want to use the $vertexcolor, $receiveflashlight, $nocull and $translucent parameters too.
  • Unless you are overwriting detail\detailsprites.vmt, mappers must remember to select the correct material in Map > Map Properties....