[backcolor=rgb(250, 250, 250) !important][size=1em]1
[size=1em]2
[backcolor=rgb(250, 250, 250) !important][size=1em]3
[size=1em]4
[backcolor=rgb(250, 250, 250) !important][size=1em]5
[size=1em]6
[backcolor=rgb(250, 250, 250) !important][size=1em]7
[size=1em]8
[backcolor=rgb(250, 250, 250) !important][size=1em]9
[size=1em]10
[backcolor=rgb(250, 250, 250) !important][size=1em]11
[size=1em]12
[backcolor=rgb(250, 250, 250) !important][size=1em]13
[size=1em]14
[backcolor=rgb(250, 250, 250) !important][size=1em]15
[size=1em]16
[backcolor=rgb(250, 250, 250) !important][size=1em]17
[size=1em]18
[backcolor=rgb(250, 250, 250) !important][size=1em]19
[size=1em]20
[backcolor=rgb(250, 250, 250) !important][size=1em]21
[size=1em]22
[backcolor=rgb(250, 250, 250) !important][size=1em]23
[size=1em]24
[backcolor=rgb(250, 250, 250) !important][size=1em]25
[size=1em]26
[backcolor=rgb(250, 250, 250) !important][size=1em]27
[size=1em]28
[backcolor=rgb(250, 250, 250) !important][size=1em]29
[size=1em]30
[backcolor=rgb(250, 250, 250) !important][size=1em]31
[size=1em]32
[backcolor=rgb(250, 250, 250) !important][size=1em]33
[size=1em]34
[backcolor=rgb(250, 250, 250) !important][size=1em]35
[size=1em]36
[backcolor=rgb(250, 250, 250) !important][size=1em]37
| [size=1em][backcolor=rgb(250, 250, 250) !important][size=1em]inline float4 AnimateVertex2(float4 pos, float3 normal, float4 animParams,float4 wind,float2 time)
[size=1em]{
[backcolor=rgb(250, 250, 250) !important][size=1em] // animParams stored in color
[size=1em] // animParams.x = branch phase
[backcolor=rgb(250, 250, 250) !important][size=1em] // animParams.y = edge flutter factor
[size=1em] // animParams.z = primary factor
[backcolor=rgb(250, 250, 250) !important][size=1em] // animParams.w = secondary factor
[size=1em]
[backcolor=rgb(250, 250, 250) !important][size=1em] float fDetailAmp = 0.1f;
[size=1em] float fBranchAmp = 0.3f;
[backcolor=rgb(250, 250, 250) !important][size=1em]
[size=1em] // Phases (object, vertex, branch)
[backcolor=rgb(250, 250, 250) !important][size=1em] float fObjPhase = dot(_Object2World[3].xyz, 1);
[size=1em] float fBranchPhase = fObjPhase + animParams.x;
[backcolor=rgb(250, 250, 250) !important][size=1em]
[size=1em] float fVtxPhase = dot(pos.xyz, animParams.y + fBranchPhase);
[backcolor=rgb(250, 250, 250) !important][size=1em]
[size=1em] // x is used for edges; y is used for branches
[backcolor=rgb(250, 250, 250) !important][size=1em] float2 vWavesIn = time + float2(fVtxPhase, fBranchPhase );
[size=1em]
[backcolor=rgb(250, 250, 250) !important][size=1em] // 1.975, 0.793, 0.375, 0.193 are good frequencies
[size=1em] float4 vWaves = (frac( vWavesIn.xxyy * float4(1.975, 0.793, 0.375, 0.193) ) * 2.0 - 1.0);
[backcolor=rgb(250, 250, 250) !important][size=1em]
[size=1em] vWaves = SmoothTriangleWave( vWaves );
[backcolor=rgb(250, 250, 250) !important][size=1em] float2 vWavesSum = vWaves.xz + vWaves.yw;
[size=1em]
[backcolor=rgb(250, 250, 250) !important][size=1em] // Edge (xz) and branch bending (y)
[size=1em] float3 bend = animParams.y * fDetailAmp * normal.xyz;
[backcolor=rgb(250, 250, 250) !important][size=1em] bend.y = animParams.w * fBranchAmp;
[size=1em] pos.xyz += ((vWavesSum.xyx * bend) + (wind.xyz * vWavesSum.y * animParams.w)) * wind.w;
[backcolor=rgb(250, 250, 250) !important][size=1em]
[size=1em] // Primary bending
[backcolor=rgb(250, 250, 250) !important][size=1em] // Displace position
[size=1em] pos.xyz += animParams.z * wind.xyz;
[backcolor=rgb(250, 250, 250) !important][size=1em]
[size=1em] return pos;
[backcolor=rgb(250, 250, 250) !important][size=1em]}
|