Ads keep us online. Without them, we wouldn't exist. We don't have paywalls or sell mods - we never will. But every month we have large bills and running ads is our only way to cover them. Please consider unblocking us. Thank you from GameBanana <3

Swaying Trees on ALL Source Games - A Tutorial for Source Engine

Swaying trees without $treeSway parameter.

This is a tutorial for games that  do not  support $treeSway.

$treeSway is a VMT texture parameter that allows trees and such to appear to sway from the wind. However this is not supported on older games such as CS:S, HL2 etc.
It actually exists in GMod but flickers when lit by flashlight

So here's how to achieve similar effect without $treeSway:

It won't actually bend the trees, but works as good for slight wind swaying.
-Find what texture the leaves of the trees use, and open the VMT.
-Next, add these proxies to it

"$translate" "[0 0]"

"Proxies"
{
Sine
{
sineperiod 4
sinemin 0
sinemax 0.005
timeoffset 0
resultVar "$translate[0]"
}
Sine
{
sineperiod 5.5
sinemin 0
sinemax 0.005
timeoffset 0
resultVar "$translate[1]"
}

TextureTransform
{
translateVar $translate
resultVar $basetexturetransform
}
}

You can scale the sineperiod values for slower/faster movement.

Note:
If you see unexpected results, you'll need to tweak the sinemin and sinemax parameters.
That's because these values were typed in for a specific tree, and since we generally dont know what the UV map of each tree looks like, the values might need some adjusting.

I don't know if a whole forest of trees with this will make it lag, but this effect costs virtually no fps if you see a small number of trees with this, at once (in the PVS).

Well, happy mapping! (with swaying trees :) )

Details

Difficulty Level
Beginner