Create vectors for braid (VEX)

For creating braids, the guide curve needs an axis system on each point so the created curves can be displaced to the right direction. This setup creates the vectors but it needs the tangentu and curveu vectors from Houdini’s resample node to work. 

This script will create a three vector axis system that includes the tangentu, tangentv, and cross vectors. The script includes two parameters, twist and offset. the offset will rotate the axis system around the curve and twist will rotate the axis system around the curve blended along the length of the curve. 

The second script will create the same vectors but it will align the axis system to the skin geometry. For this to work, it needs point normals transferred from the skin. This can be done with an attribute transfer node. 

For the Braid from curve (VEX) script or Multiply curve (VEX) script to work it needs either of these scripts to be run before it.

//Run over points

vector tmp = {1,0,0};
vector tangentu = normalize(v@tangentu);
vector tangentv = cross(tmp,tangentu);
vector cross = cross(tangentv,tangentu);

float twist = chramp("twist",@curveu) * 2*PI;

float offset_t = chf("offset")*2*PI + twist;
float offset_c = offset_t+(PI/2);

vector tangentv_n = (sin(offset_t) * tangentv) + (cos(offset_t)* cross);
vector cross_n = (sin(offset_c) * tangentv) + (cos(offset_c)* cross);

v@tangentv = normalize(tangentv_n);
v@cross = normalize(cross_n);
v@tangentu = tangentu;
 

Create surface aligned vectors for braid (transfer point normals from skin before)

//Run over points

vector n = normalize(v@N);
vector tan = normalize(v@tangentu);

vector cross = cross(n,tan);

v@cross = cross;
v@tangentv = n;
v@tangentu = tan;
Previous
Previous

Multiply curve (VEX)

Next
Next

Enhance curve shape (VEX)