Mjag07 Posted August 13 Share Posted August 13 Im stumped I have a curve setup. Also using a sweep node to create a ribbon which is fine. But it seems to not have very many adjustments to the amount and area of the twist/coil effect. Im leaning towards one that has some randomness and being able to adjust the tightness of the coil in some areas. Any help or info with this would be great. Thanks Quote Link to comment Share on other sites More sharing options...
Librarian Posted August 14 Share Posted August 14 (edited) make grid -only rows- use this and join SOP with sweep SOP. // Parameters int num_strands = chi("num_strands"); // Number of strands in the braid float braid_radius = chf("braid_radius"); // Radius of the braid float braid_length = chf("braid_length"); // Length of the braid float twist_factor = chf("twist_factor"); // Twist factor for the braid pattern float length_variation = chf("length_variation"); // Variation in the length of each strand float random_offset = chf("random_offset"); // Strength of random offsets for variation float noise_freq = chf("noise_freq"); // Frequency of the noise for variation // Calculate the angle increment for each strand float angle_increment = 2 * M_PI / num_strands; // Loop through each point and set its position int pt_num = @ptnum; float t = pt_num / float(@numpt) * braid_length; // Determine the strand index and angle for this point int strand_index = pt_num % num_strands; float angle = angle_increment * strand_index + twist_factor * t; // Add variation to the length float length_var = t + sin(t * length_variation) * braid_length * 0.1; // Calculate the position of the point with noise vector pos; pos.x = braid_radius * cos(angle) + noise(set(t * noise_freq, strand_index, 0)) * random_offset; pos.y = length_var; pos.z = braid_radius * sin(angle) + noise(set(t * noise_freq, strand_index, 1)) * random_offset; // Set the position @P = pos; // Optionally, set other attributes like color for visualization vector color = set(sin(angle) * 0.5 + 0.5, cos(angle) * 0.5 + 0.5, 1.0); @Cd = color; on curve with tang float p = float(@ptnum)/(@numpt-1); float ang = radians(p*360*chi("spiralNum")); float radi = ch("radi"); radi *= chramp("parm",p); vector4 quat = dihedral({0,1,0},v@tangentu); vector zaxis = qrotate(quat,{0,0,1}); quat = quaternion(ang,v@tangentu); zaxis = qrotate(quat,zaxis); @P += radi*zaxis; Edited August 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.