Rival Consoles Posted October 18 Share Posted October 18 Hi there, I'm researching organic deformation on geometric grids and could accomplish some interesting deformation on a quad grid as the img below. Newby stuff However, I'm trying to find a way to create the exact deformation on a triangle grid or a remeshed grid. Would someone have an idea about how I can approach this? Any info on how to start is appreciated. Cheers Quote Link to comment Share on other sites More sharing options...
Librarian Posted October 18 Share Posted October 18 (edited) @Rival Consoles surface deform SOP , vellum , New Linear Solver , POP to deform only P................................................ 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; Edited October 18 by Librarian 1 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.