Houdini VEX Temp
Jump to navigation
Jump to search
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); }