Jump to content

Coiled ribbon


Mjag07

Recommended Posts

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

Balloons_String.jpg

Link to comment
Share on other sites

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 by Librarian
  • Like 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...