Difference between revisions of "$treeSway"

From Valve Developer Community
Jump to: navigation, search
m
(Moved around some notes and confirmed this parameter was never supposed to be compatible with $bumpmap)
 
Line 1: Line 1:
 
[[File:de_lake_treesway.gif|thumb|Tree with treesway on de_lake in CS:GO (click on image for gif to play).]]
 
[[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 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}}.}}
+
<code>$treesway</code> 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 is disabled by default in the {{as}} SDK. It can re-enabled by modding.}}
+
 
{{warning| In {{csgo}} it will stop ''swaying'' if the material uses [[$bumpmap]]. {{todo|Is this {{csgo}} only limitation?}}}}
+
{{warning|Due to the way bumped lighting is calculated, <code>$treesway</code> will not sway materials which use {{ent|$bumpmap}}.}}
{{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.}}
+
{{note|This shader parameter is disabled by default in the {{as}} SDK. It can re-enabled by modding.}}
 +
{{bug|In {{GMOD}}{{mapbase}}, using a shadow-casting [[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.}}
 
: {{todo|What about <code>$singlepassflashlight</code> and <code>$flashlightnolambert</code>?}}
 
: {{todo|What about <code>$singlepassflashlight</code> and <code>$flashlightnolambert</code>?}}
  

Latest revision as of 08:35, 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 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.

$treesway 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.

Warning.png Warning: Due to the way bumped lighting is calculated, $treesway will not sway materials which use $bumpmap.
Note.png Note: This shader parameter 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 shadow-casting 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.
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