CinnamonMetal Posted April 16, 2018 Share Posted April 16, 2018 I'm hoping someone can help. I'm attempting to do a parallel transform for points on a mesh; whereas the tangent of the point follows the surface, another vector follows the edge to which the vector rests upon and finally the normal for the point. If you take this code apply it to a sphere making sure the fuse sop is after the sphere followed by a primitive wrangler it should work with no errors. This setup is taken from an Entagma tutorial; the first problem is, I'm not seeing tangents for each of the points after creating the attribute for the tangent ? i[]@vrtList = primvertices(0,@primnum); int vp1 = vertexpoint(0, @vrtList[0]); int vp2 = vertexpoint(0, @vrtList[1]); vector midpoint = lerp(point(0, "P", vp1), point(0, "P", vp2), 0.5); i@PointList = addpoint(0,midpoint); int pnts[] = primpoints(0,@PointList); int pointCount = len(pnts); vector firstTangent = normalize(point(0,"P",pnts[1]) - point(0,"P",pnts[0])); vector firstNormal = {0,1,0}; vector helper = normalize(cross(firstNormal,firstTangent)); firstNormal = normalize(cross(firstTangent,helper)); // Forward Declarations vector bitangent = {0,0,0}; float theta = 0; vector tangents[] = {}; vector normals[] = {}; // fill arrays for(int i = 0; i<pointCount-1;i++){ push(tangents,normalize(point(0,"P",pnts[i+1]) - point(0,"P",pnts[i]))); push(normals,firstNormal); } // set values for last point push(tangents,tangents[pointCount-2]); push(normals,normals[pointCount-2]); //parallel transport // set attributes for(int j=0;j<pointCount;j++){ setpointattrib(0,"PT_tangent",pnts[j],tangents[j],"set"); } //vector helper = cross( //vector mainPoint = //vector firstTangent = 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.