VEX

Some useful VEX.
DOP Random Air Resistance
DOP Random Spin

SOP Fake Collisions
SOP Delete Points by Threshold
SOP Random Pscale with Ramp-weighting, Seed, Min and Max
SOP Random Rotations
SOP Rotations

 

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 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 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 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 = ch("rot_amount");
float rand = fit01(random(@ptnum+311),0,angle);
p@rot = quaternion(radians(rand), v@up);

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);