Paweł Łukaszewicz

Generative01 VEX

Houdini, Redshift.(artstation)

VEX do wrangla generującego i animującego połączenia poniżej:

float max_dist = ch("max_dist");
int max_pts = chi("max_neighbours");
int max_conns = chi("max_connections");
int frames_per_step = chi("frames_per_step");
int forks_per_round = chi("forks_per_round");
float step = (@Frame-1)%frames_per_step;

vector getAnimatedPos(int step; vector going_from; vector going_to; int frames_per_step )
{
    return going_from+(going_to-going_from)*smooth(0,frames_per_step,step+0.1);
}

if (0 == step) 
{
    if (@in_connected > 0 && @in_connected < max_conns && @in_dont_touch == 0) { int this_round =0; int pts[] = nearpoints(0,@P,max_dist,max_pts); foreach(int pt; pts) { if (pt==@ptnum) continue; if (point(0,"in_connected",pt)>0) continue;
        if (point(0,"in_dont_touch",pt)>0) continue;
        
        @in_connected+=1;
        vector pos_to = point(0,"P",pt);
        vector pos_from = @P;
        int pt2 = addpoint(0,pos_from/*@ptnum*/);
        setpointattrib(0,"in_dont_touch",pt2,1,"set");
        setpointattrib(0,"going_to",pt2,pos_to,"set");
        setpointattrib(0,"going_from",pt2,pos_from,"set");
        setpointattrib(0,"Cd",pt2,@Cd,"set");
        setpointattrib(0,"Cd",pt,@Cd,"set");
        setpointattrib(0,"P",pt2
                       ,getAnimatedPos(step+1, pos_from, pos_to, frames_per_step)
                       ,"set");
        setpointattrib(0,"colorStart",pt2,@Frame,"set");
        if(point(0,"colorStart",pt)==0)
        {
            setpointattrib(0,"colorStart",pt,@Frame,"set");
        }
        if(i@colorStart==0) 
        {
            setpointattrib(0,"colorStart",@ptnum,@Frame,"set");
        }
        int prim = addprim(0,"polyline");
        addvertex(0,prim,@ptnum);
        addvertex(0,prim,pt2);  
        setpointattrib(0,"in_connected",pt,1,"set");
        this_round++;
        if (this_round >= forks_per_round) break;
      }
    }
}
else
{
     if (@in_dont_touch==1)   
     {
        @P=getAnimatedPos( step+1, v@going_from, v@going_to,frames_per_step);
        if (step == frames_per_step-1) i@in_dont_touch=2;
     }
}

 

 

Wykorzystane ponownie przy wizualizacjach koncertowych dla Folk’N’Roll:

 



Check other portfolio, programowanie, 3d, hobby, Animacje, Uncategorized projects