Page 1 of 1

TreeIt Wind Animation

PostPosted: Wed Jan 16, 2019 2:54 pm
by wiseguy
Without any luck, I'm trying to understand the vertex animation code in the example shaders Tree.fx and Leaf.fx.

Does anyone have a clue how all those wind parameters work?

Why does it have to be that complex?

Code: Select all
// aplication time scaled with factors (0.1, 1, 2, 20) and divided by 57.3 (degrees to radians?)
float4 TreeWindTimer;
float4 TreeWindSize={500, 250, 75, 0.5f};
float3 TreeWindPower={3, 3, 1.5};

float3 TreeGlobalWind=(mul(IN.Pos,World).xyz/TreeWindSize.x)+TreeWindTimer.x;
TreeGlobalWind.x=1+abs(dot(cos(TreeGlobalWind),sin(TreeGlobalWind)));
float3 TreeWindForce=normalize(IN.Pos.xyz)+TreeWindTimer.y;
TreeWindForce.x=sin(TreeWindForce.x);
TreeWindForce.y=0;
TreeWindForce.z=cos(TreeWindForce.z);
float3 WindAnimate=(TreeWindForce*TreeWindPower.x)*(IN.Pos.y/TreeWindSize.y);
float3 TreeWindVariant=normalize(float3(IN.Pos.x,IN.Pos.y/TreeWindSize.z,IN.Pos.z))+TreeWindTimer.z+(IN.Color.y*10);
WindAnimate +=(cos(TreeWindVariant)*TreeWindPower.y)*pow(IN.Color.z,2);

float4 NewPos=float4(IN.Pos.xyz+WindAnimate*TreeGlobalWind.x,1);

Re: TreeIt Wind Animation

PostPosted: Thu May 23, 2019 4:54 pm
by Crashy
Hi,
I'd like to have more infos about it too.
More than just the math (I could copy it and hope it'll work), the various ranges and behaviour of time parameters is also unknown.
Is this something meant to be "compatible" with UE4 foliage animation or is it something completely custom ?