DOP Random Air Resistance
DOP Random Spin

SOP Build Matrix
SOP Fake Collisions

SOP move points towards surface (mapped distance)
SOP Delete Points by Threshold

SOP Line Network
SOP Random Pscale with Ramp-weighting, Seed, Min and Max
SOP Random Rotations
SOP Rotations

SOP Rotations Around Axis
SOP Spiral Curve


DOP Random Air Resistance

This one-liner will simply add random air resistance per particle within the minimum and maximum values

airresist *= fit01(@id,0.05,1);

DOP Random Spin

This adds random spin to particles – put it in the popspin DOP

//Add Min and Max controls to node
axis = rand(@id) - set(0.5, 0.5, 0.5);
spinspeed *= fit01(rand(@id+0.1), ch("Min"), ch("Max"));

SOP Build Matrix

These wrangles will build a matrix, move the animated geo to the origin and then revert it back to it’s original world space.

// Get center of the oject bounding box (centroid)
vector min = {0, 0, 0};
vector max = {0, 0, 0};
getpointbbox(0, min, max);
vector centroid = (max + min)/2.0;

//get alignment angle
vector __base = {0,0,1};

//manual asignment of using two points to get vector of rotation
vector __align = normalize( point(0, "P", 4) - point(0, "P", 5));
float __rads = acos(dot(__base, __align));
float __angle = degrees(__rads);

// Build and apply transformation matrix
vector translate = centroid;
vector rotate = set(0,__angle,0);
vector scale = {1,1,1};
matrix xform = invert(maketransform(0, 0, translate, rotate, scale));
@P *= xform;

// Store transformation matrix in attribute
4@xform_matrix = xform;
@P *= invert(4@xform_matrix);

SOP Fake Collisions Wrangle

This fella will push points within a volume outside of the volume. Pipe the collision SDF into the second input.

vector grad = volumegradient(1, 0, @P);
float dist = volumesample(1, 0, @P);
    if(dist <= 0)
        @P -= normalize(grad) * dist;

SOP move points towards surface (mapped distance)

I found this here. From FX artist Kevin Pinga.

//initializing variables
int p_prim;
vector p_puv;

//getting the distance and the parametric position of the closest point
float dist = xyzdist(1,@P,p_prim,p_puv);
vector P2= primuv(1,"P",p_prim,p_puv);

//mixing the P of the points, influenced by a mapped distance
@P = fit(dist,chf("min_dist"),chf("max_dist"),P2,@P);

SOP Delete Points by Threshold

This snippet will delete random points based on the threshold slider. Taken from http://www.tokeru.com

if ( rand(@ptnum) > ch('threshold') ) {
   removepoint(0,@ptnum);
}

SOP Create Lines Network

This snippet will create a network of lines based on distance threshold. Taken from Entagma’s “Creating Geo With Vex”  video

float searchrad = ch("rad");

int nearpnts[] = nearpoints(0, @P, searchrad);

foreach(int pnt; nearpnts){

    int line = addprim(0, "polyline");
    addvertex(0, line, @ptnum);
    addvertex(0, line, pnt);
    }

SOP Random pscale with Ramp, Seed, Min and Max

This useful little dude will create a ramp that can be used with minimum, maximum and seed values to generate random pscale values with weighting.

@pscale = fit01(chramp("Width", rand(@id  + ch("Seed"))), ch("Min"), ch("Max"));

A corresponding Attribute VOP would look something like this:

SOP Random Rotation Wrangle

A basic random rotation wrangle

float angle;
angle = @Frame*chf("mult")*fit01(rand(@id), chf("min"), chf("max"));

@orient = quaternion(angle, v@N);
v@up=v@N;

SOP Rotation Wrangle

This guy will enable randomised rotations on particles. Add a time variable ($T/$F) into the angle input to get them moving.

f@speed = fit01(rand(@ptnum), ch('minSpeed'), ch('maxSpeed'));

float angle = (ch('angle')+@ptnum)*@speed;
vector axis = sample_direction_uniform(rand(@ptnum*ch('seed')));

@orient = quaternion(angle, axis);

SOP Rotate Around Axis

float angle = chf("angle");
vector4 rot = quaternion(radians(angle), {1,0,0});

@N=qrotate(rot, @N);

SOP Spiral Curve

Makes input curve into a spiral with controls

@P.x = cos(@ptnum * ch("frequency")) * ch("amp_x") + ch("offset_x");
@P.y = @ptnum * ch("amp_y");
@P.z = sin(@ptnum * ch("frequency")) * ch("amp_z") + ch("offset_z");