Houdini VEX Temp
Jump to navigation
Jump to search
points to curves
int primN; vector primUv; float dist = xyzdist(1,@P,primN,primUv); float minspeed = chf('minspeed'); float maxspeed = chf('maxspeed'); primUv[0] = (primUv[0]+@Time*fit01(rand(@ptnum),minspeed,maxspeed))%1; vector pos = primuv(1,"P",primN,primUv); //cast variables if needed f@dist = dist; i@primN = primN; v@primUv = primUv; @P = lerp(pos,@P,chf('lerp'));
topo transfer
string vals[] =split(chs("../topotransfer2/sourcepos1",0)); string coord[] = split(vals[@ptnum],','); string pos = vals[@ptnum]; string x = split(pos,',')[0]; string y = split(pos,',')[1]; string z = split(pos,',')[2]; @P = set(atof(x),atof(y),atof(z));
Sample Randoms
vector2 randV = rand(@ptnum); @P = sample_circle_uniform(randV); @P = sample_circle_edge_uniform(rand(@ptnum)); @P = sample_circle_ring_uniform(randV,.65); @P = sample_circle_slice({0,1},3.14/4,randV);
Fuse and accumulate pscale
requires id = ptnum
float accumulation = 0; if(@group_snapped_points){ int pts[] = findattribval(0,"point","snapped_to",@ptnum); i@fusedpts = len(pts); foreach(int id;pts){ accumulation += pow( point( 0, "pscale", id ) / 2.0 , 3 ); } @pscale = 2 * pow(accumulation , 1.0/3); } if(@snapped_to != -1 && @ptnum != @snapped_to){ removepoint(0,@ptnum); }
Attractors
attr wrangle
float radius = chf('max_radius'); int maxpoints =chi('max_points'); int pnum; for(int i=0;i<npoints(1);i++){ vector pos = point(1,"P",i); int pc = pcopen(0,'P',pos,radius,maxpoints ); while(pciterate(pc)){ pcimport(pc,'point.number',pnum); vector p = point(0,'P',pnum); float ratio = length(pos-p)/radius; float falloff = chramp('falloff',ratio); vector newpos = lerp(pos,p,falloff); //addColor vector newcol = hsvtorgb(float(rand(pos)),falloff,1); setpointattrib(0,'Cd',pnum,newcol); setpointattrib(0,'P',pnum,newpos); setpointattrib(0,'falloff',pnum,falloff); } }
i think it's slow and stupid this is better (point wrangle)
float maxdist = chf('maxdistance'); float @distance[]; for(int i=0;i<npoints(1);i++){ vector pos = point(1,'P',i); float dist = clamp(distance(@P,pos)/maxdist,0,1); float falloff = chramp('falloff',1-dist); @P = lerp(@P,pos,falloff); //append(@distance,distance(@P,pos)); append(@distance,dist); }