VEX实现程序化开花动画

效果如下: 

简单开花动画: 

vector pos = point(1,"P",0);
vector dir = pos - @P;
float dist = length(dir);
v@ndir = normalize(dir);

f@dist = dist;
float max_dist = detail(0,"dist",0);
f@dist /= max_dist;

f@dist = chramp("dist",f@dist);
@P += v@ndir*f@dist*1.2*@P.y;

控制开花顺序: 

float max_dist = 0;

int num = npoints(0);

for(int i=0;imax_dist) max_dist = dist;
}

f@max_dist = max_dist;
f@max_dist /= detail(0,"max_dist");

按顺序进行动画: 

float mix = chramp("dist",f@max_dist) - 1 + chf("mix");

mix = clamp(mix,0,1);
@P = lerp(@P,v@rest,mix);

反转法线:(二选一) 

1.polyframe

@N *= -1;

2.

int num = npoints(0);
vector sum = {0,0,0};

for(int i=1;i
v@N = detail(0,"normal");

你可能感兴趣的:(#,VEX,houdini)