$treesway: Difference between revisions
SirYodaJedi (talk | contribs) No edit summary |
ShiroDkxtro2 (talk | contribs) m (Solving the TODO about the impact $SinglePassFlashlight and $FlashlightNoLambert on $TreeSway) |
||
Line 10: | Line 10: | ||
* This shader parameter does not work with [[$detail#Parameters and Effects|$detailtexturetransform]]. | * This shader parameter does not work with [[$detail#Parameters and Effects|$detailtexturetransform]]. | ||
* 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. | * 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. | ||
* In {{mapbase}}, using a shadow-casting [[env_projectedtexture|projected texture]] will cause shadows not reacting to <code>$treesway</code>, shadows don't move, | * In {{mapbase}}, using a shadow-casting [[env_projectedtexture|projected texture]] will cause shadows not reacting to <code>$treesway</code>, shadows don't move, except in {{gmod}} and Games now running on the 'TF2 SDK' ( 2025 Version of SDK2013MP ).}} | ||
{{note|There was a TODO here, asking about the impact of $singlepassflashlight and $flashlightnolambert on this.<br> | |||
its important to clarify this to avoid further confusion:<br> | |||
These are Parameteres that affect the rendered Material only.<br> | |||
For creating the 'Shadow Map' ( Depth Texture, Projected Texture, etc ), an entirely separate Shader is used.<br> | |||
That Shader (DepthWrite) did not have the $TreeSway Code, causing Shadows to be entirely unaffected by this feature.<br> | |||
It can't 'simply' be added either, only some Parameters from the original Material are copied to it.<br> | |||
And in case of SDK2013SP ( What MapBase is running on, for now ) does not allow an easy replacement of the existing DepthWrite Shader.}} | |||
{{modernImportant|While $TreeSway can be used to animate a {{ent|prop_static}}, lightmap shadows casted by swaying static props will remain static.<br>'''''If [[CSM]] is unavailable''''', consider using a {{ent|prop_dynamic}} instead. This can be combined with an animation containing more realistic pre-baked wind physics than can be achieved with $treesway.<br>As {{ent|prop_dynamic}} cannot be lit by [[VRAD]] per-vertex, it may be desirable to use a pre-baked {{ent|$lightmap}} (if available) in such situations, to restore some ambient lighting quality.}} | {{modernImportant|While $TreeSway can be used to animate a {{ent|prop_static}}, lightmap shadows casted by swaying static props will remain static.<br>'''''If [[CSM]] is unavailable''''', consider using a {{ent|prop_dynamic}} instead. This can be combined with an animation containing more realistic pre-baked wind physics than can be achieved with $treesway.<br>As {{ent|prop_dynamic}} cannot be lit by [[VRAD]] per-vertex, it may be desirable to use a pre-baked {{ent|$lightmap}} (if available) in such situations, to restore some ambient lighting quality.}} |
Revision as of 00:57, 9 June 2025


$treesway
is a material shader parameter for the VertexLitGeneric shader available in all Source games since
Left 4 Dead 2. (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.

$treesway
will not sway materials which use $bumpmap.
- 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, except inand Games now running on the 'TF2 SDK' ( 2025 Version of SDK2013MP ). [todo tested in ?]

its important to clarify this to avoid further confusion:
These are Parameteres that affect the rendered Material only.
For creating the 'Shadow Map' ( Depth Texture, Projected Texture, etc ), an entirely separate Shader is used.
That Shader (DepthWrite) did not have the $TreeSway Code, causing Shadows to be entirely unaffected by this feature.
It can't 'simply' be added either, only some Parameters from the original Material are copied to it.

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
$treesway
$treeswayheight
$treeswaystartheight
$treeswayradius
$treeswaystartradius
$treeswayspeed
$treeswaystrength
$treeswayscrumblespeed
$treeswayscrumblestrength
$treeswayscrumblefrequency
$treeswayfalloffexp
$treeswayscrumblefalloffexp
$treeswayspeedhighwindmultipler
$treeswayspeedlerpstart
$treeswayspeedlerpend
$treeswaystatic
$treeswaystaticvalues
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.