Difference between revisions of "$treeSway"

From Valve Developer Community
Jump to: navigation, search
(Updated game implementation info; added Mapbase $treeSway implementation)
(Added a very super cool gif image and added a warning that $bumpmap breaks it, whoever plays old games please confirm it does it there too)
Line 1: Line 1:
{{screenshot}}
+
[[File:de_lake_treesway.gif|thumb|Tree with treesway on de_lake in CS:GO (click on image for gif to play).]]
 
{{Shaderparam|$treesway|since=Left 4 Dead|shader1=VertexLitGeneric}} It morphs a material around using the parameters of an {{ent|env_wind}} entity to give the appearance of tree leaves and foilage blowing in the wind. The subparameters of <code>$treesway</code> determine how much the <code>env_wind</code> entity should affect the morphing, and all of them (except <code>$treeswaystatic</code>) must be specified in order for the effect to work properly. This shader parameter assumes any model using it is facing upwards.
 
{{Shaderparam|$treesway|since=Left 4 Dead|shader1=VertexLitGeneric}} It morphs a material around using the parameters of an {{ent|env_wind}} entity to give the appearance of tree leaves and foilage blowing in the wind. The subparameters of <code>$treesway</code> determine how much the <code>env_wind</code> entity should affect the morphing, and all of them (except <code>$treeswaystatic</code>) must be specified in order for the effect to work properly. This shader parameter assumes any model using it is facing upwards.
 +
 
{{note|This shader parameter is also available in {{tf2}}{{Bms}}{{GMOD}}{{mapbase}}. In {{GMOD}}{{mapbase}}, it can also be used for {{ent|UnlitGeneric}}.}}
 
{{note|This shader parameter is also available in {{tf2}}{{Bms}}{{GMOD}}{{mapbase}}. In {{GMOD}}{{mapbase}}, it can also be used for {{ent|UnlitGeneric}}.}}
 
{{note|This shader is disabled by default in the {{as}} SDK. It can re-enabled by modding.}}
 
{{note|This shader is disabled by default in the {{as}} SDK. It can re-enabled by modding.}}
 
{{bug|In {{GMOD}}{{mapbase}}, using a [[env_projectedtexture|projected texture]] on materials with this parameter will cause flickering. As a workaround, try to keep trees away from where player flashlights can reach. {{ent|$halflambert}} may also partially fix the issue.}}
 
{{bug|In {{GMOD}}{{mapbase}}, using a [[env_projectedtexture|projected texture]] on materials with this parameter will cause flickering. As a workaround, try to keep trees away from where player flashlights can reach. {{ent|$halflambert}} may also partially fix the issue.}}
 +
{{warning| In {{csgo}} it will stop ''swaying'' if the material uses [[$bumpmap]]. {{todo|Is this {{csgo}} only limitation?}}}}
 
: {{todo|What about <code>$singlepassflashlight</code> and <code>$flashlightnolambert</code>?}}
 
: {{todo|What about <code>$singlepassflashlight</code> and <code>$flashlightnolambert</code>?}}
  

Revision as of 05:44, 20 November 2020

Tree with treesway on de_lake in CS:GO (click on image for gif to play).

$treesway is a material shader parameter available in all Source games since Left 4 Dead Left 4 Dead for VertexLitGeneric. It morphs a material around using the parameters of an env_wind entity to give the appearance of tree leaves and foilage blowing in the wind. The subparameters of $treesway determine how much the env_wind entity should affect the morphing, and all of them (except $treeswaystatic) must be specified in order for the effect to work properly. This shader parameter assumes any model using it is facing upwards.

Note.png Note: This shader parameter is also available in Team Fortress 2Black Mesa (Source)Garry's Mod<Mapbase>. In Garry's Mod<Mapbase>, it can also be used for UnlitGeneric.
Note.png Note: This shader is disabled by default in the Alien Swarm SDK. It can re-enabled by modding.
Bug.png Bug: In Garry's Mod<Mapbase>, using a projected texture on materials with this parameter will cause flickering. As a workaround, try to keep trees away from where player flashlights can reach. $halflambert may also partially fix the issue.
Warning.png Warning:  In Counter-Strike: Global Offensive it will stop swaying if the material uses $bumpmap. To do: Is this Counter-Strike: Global Offensive only limitation?
To do: What about $singlepassflashlight and $flashlightnolambert?

Parameters

$treesway <integer>
What option to use for the tree swaying effect.
  • 0: No Sway
  • 1: "Classic" tree sway.
  • 2: Radial tree sway effect, intended for use on rectangular sheets of plastic/tarp attached at four corners. It inverts the sway scale radius to be 1 at (0,0,0) in model space and to fall off radially towards the edges of the model.
    Note.png Note: Models using $treesway 2 are expected to be built lying in the X Y plane in model space, with their center at the origin.
$treeswayheight <float>
The starting height in Hammer units where the effect should start being fully applied. Default 1000.
$treeswaystartheight <float>
The height from the model's origin in which the effect starts blending in. Default 0.2.
$treeswayradius <float>
The radius from the model's origin in Hammer units in where the effect should start being fully applied. Default 300.
$treeswaystartradius <float>
The radius from the model's origin in which the effect starts blending in. Default 0.1.
$treeswayspeed <float>
The speed multiplier of large movement such as the trunk. Default 1.
$treeswaystrength <float>
The distance multiplier of large movement such as the trunk. Default 10.
$treeswayscrumblespeed <float>
The falloff of the effect on large movement such as the trunk. Higher means a more stable center. Default 0.1.
$treeswayscrumblestrength <float>
The speed multiplier of the small movement such as the leaves. Default 0.1.
$treeswayscrumblefrequency <float>
The distance multiplier of the small movement such as the leaves. Default 0.1.
$treeswayfalloffexp <float>
The frequency of the rippling of a sine wave in small movement such as the leaves. Default 1.5.
$treeswayscrumblefalloffexp <float>
The falloff of the effect on small movement such as the leaves. Higher means a more stable center. Default 1.
$treeswayspeedhighwindmultipler <float>
Speed multiplier when env_wind triggers a gust. Default 2.
$treeswayspeedlerpstart <float>
Minimum wind speed in which a gust triggered by env_wind will start affecting the material. Default 3.
$treeswayspeedlerpend <float>
Minimum wind speed in which a gust triggered by env_wind will fully affect the material. Default 6.
$treeswaystatic <float> (only in Team Fortress 2Counter-Strike: Global OffensiveGarry's Mod<Mapbase>)
Use a static wind value instead of the values from env_wind. If enabled, env_wind is not required.
$treeswaystaticvalues <vector2> (only in <Mapbase>)
Sets the static wind values used by $treeswaystatic, syntax [x y]. Default [0.5 0.5].

See Also

https://gamebanana.com/tuts/12924 - How to achieve a similar effect without $treeSway, on all source engine games