$treesway
![](/w/images/thumb/4/49/De_lake_treesway.gif/300px-De_lake_treesway.gif)
![de_lake](/w/images/thumb/b/b6/De_lake.png/16px-De_lake.png)
$treesway
is a material shader parameter available in all Source games since
Left 4 Dead 2 for
VertexLitGeneric
. (also in
) In
, it can also be used for
UnlitGeneric
.
$treesway
morphs the vertices of a mesh with a given 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](/w/images/thumb/c/cb/Warning.png/10px-Warning.png)
$treesway
will not sway materials which use $bumpmap
.![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
- This shader parameter does not work with $detailtexturetransform.
- In
, 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. - In
, using a shadow-casting projected texture will cause shadows not reacting to
$treesway
, shadows don't move, expect in.
Todo: What about
$singlepassflashlight
and$flashlightnolambert
?
![Icon-Important.png](/w/images/thumb/5/5c/Icon-Important.png/10px-Icon-Important.png)
prop_static
, lightmap shadows casted by swaying static props will remain static.If CSM is unavailable, consider using a
prop_dynamic
instead. This can be combined with an animation containing more realistic pre-baked wind physics than can be achieved with $treesway.As
prop_dynamic
cannot be lit by VRAD per-vertex, it may be desirable to use a pre-baked $lightmap
(if available) in such situations, to restore some ambient lighting quality.Parameters
- 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:Models using
$treesway 2
are expected to be built lying in the X Y plane in model space, with their center at the origin.
env_wind
triggers a gust. Default 2.env_wind
will start affecting the material. Default 3.env_wind
will fully affect the material. Default 6.env_wind
. If enabled, env_wind
is not required.$treeswaystatic
, syntax [x y]
. Default [0.5 0.5]
.External links
https://gamebanana.com/tuts/12924 - How to achieve a similar effect without $treeSway
, on all source engine games. Alternatively, use an animated prop_dynamic
, for a more realistic (but more expensive) effect.