Librarian Posted May 18, 2022 Share Posted May 18, 2022 Best approach to make deform on different part of Points (colors) in various position only in x and z not height(something like fluid effect on those parts but they keep position, they just be effected like oil or fast splash ) .Thanx Deformpoints.hiplc Quote Link to comment Share on other sites More sharing options...
Librarian Posted May 18, 2022 Author Share Posted May 18, 2022 i found a way Yupiiii s@name = sprintf("piece_%d", i@iy); // get actors names string name = sprintf(s@name); // split actors name up into array using space as delimiter string actorSplit[] = split(name, " "); // join array with underscores to create the group name string groupName = join(actorSplit, "_"); // set group name setpointgroup(0, groupName, @ptnum, 1, "set"); float k = 2 *noise(@Time); @P *= set(1/sqrt(k),k,1/sqrt(k)); @P += @P *flownoise(@P*3,@Time); i[]@pCaptPts = pcfind(1,"P",@P,1e15,8); float r = 1.1 *distance(point(1,"P",@pCaptPts[-1]),@P); vector delta; float totalweight_cpt; matrix3 totalxform_cpt; foreach(int cpt;@pCaptPts){ vector oldcenter = point(1,"P",cpt);//Rest_POint_latice vector newcenter= point(2,"P",cpt);//deformed_point_latice matrix3 xform_cpt = 1; int n[] = neighbours(1,cpt); //int n[] = neighbours(2,cpt); matrix3 totalxform = 0; float totalweight = 0; if (len(n)>1){ vector lastdp,lastrestdp; for (int i;i<len(n);i++){ if(i==0){ lastdp = point(1,"P",n[-1])-oldcenter; lastrestdp = point(2,"P",n[-1])-newcenter; } vector dp = cross(dp,lastdp); vector restdp = cross(restdp,lastrestdp); vector up = cross(dp,lastdp); vector restup = cross(restdp,lastrestdp); float w = sqrt(length(up)*length(restup)); matrix3 restxform = maketransform(normalize(restdp),normalize(restup)); matrix3 xform = maketransform(normalize(dp),normalize(up)); totalxform += w*invert(xform)*restxform; totalweight += w; lastrestdp = restdp; lastdp = dp; } if(totalweight!=0){ totalxform/= totalweight; if(chi("rigidprijection")) totalxform = polardecomp(totalxform); xform_cpt = totalxform; } } float dist = distance(oldcenter,@P); float weight = pow(1-pow(dist/r,2),2); vector diff = point(2,"P",cpt)-oldcenter; vector newp = @P; newp -= oldcenter; newp *= xform_cpt; newp += oldcenter; newp += diff; delta += weight*(newp-@P); totalweight_cpt += weight; totalxform_cpt += xform_cpt*weight; } delta /= totalweight_cpt; @P += delta; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.