Tangle hairs by scattered points (VEX)

This script creates randomly rotated and scaled areas to the groom around scattered points.

To use this script, first scatter points on the groom geometry. Copy this script to a point wrangle and wire the groom to the first input and the scattered points to the second input. Don’t forget to push the “create spare parameters“ button to create a slider for the tangle sizes.

I found that by adding a resample node in “interpolating curves“ mode after the wrangle helps a lot.

I usually scatter a variety of different point clouds and combine the results.

 

Run in a point wrangle:

int npt = nearpoint(1,@P);
vector pos = point(1,"P",npt);
float dist = distance(v@P,pos);


matrix xform = ident();

float rot_x = rand(npt) *2*PI;
float rot_y = rand(npt+8234) *2*PI;
float rot_z = rand(npt+3784) *2*PI;

vector x = {1,0,0};
vector y = {0,1,0};
vector z = {0,0,1};

rotate(xform,rot_x,x);
rotate(xform,rot_y,y);
rotate(xform,rot_z,z);

vector scale = {1,1,1} * fit01(rand(npt),0.4,1.3);
scale(xform,scale);

float rand_size = rand(npt);
rand_size = fit01(rand_size,0.2,1);
float tangle_size = chf("tangle_size")*rand_size;

if ( dist < tangle_size ){
    i@group_tangle = 1;
    //v@Cd = {1,0,0}; //visualize tangle areas
    v@P = (v@P-pos) * xform + pos;
}
Previous
Previous

Enhance curve shape (VEX)

Next
Next

Copy shape from closest primitive (VEX)