Profile PictureFaddy Saeed
$3

Spiral Net Particle Generator and Pyro Velocity Enhancement in Houdini

Add to cart

Spiral Net Particle Generator and Pyro Velocity Enhancement in Houdini

$3


https://www.patreon.com/posts/spiral-net-and-90850773


The two main codes created address different aspects of particle-based simulations in Houdini. The first code involves the generation of a spiral net of points with a high level of control. It allows the user to define parameters such as the number of points, radius, height, number of turns, noise scale, and more. This code not only creates the desired shape but also introduces features like taper and twist to customize the appearance. It calculates velocity based on the direction, magnitude, and user-defined control parameters. Additionally, it sets attributes like curveu and density to provide a comprehensive tool for creating intricate particle structures.

The second code focuses on manipulating the velocity field within a pyro solver. It adds noise to the velocity field, specifically targeting particles with speeds above a user-defined threshold. The code allows for control over the direction and magnitude of the added noise, with the ability to set a range for the speed threshold. This code is useful for introducing complexity and randomness into pyro simulations, enhancing the visual impact of effects like explosions or fluid dynamics. It demonstrates how to utilize parameter fields in a DOP network to enable slider controls for key simulation parameters, granting artists flexibility and creative freedom in their work within Houdini.

spiral vex code:

int numPoints = chi("numPoints");

float radius = ch("radius");

float height = ch("height");

float turns = ch("turns");

float noiseScale = ch("noiseScale");

float noiseAmplitude = ch("noiseAmplitude");

float densityControl = ch("densityControl");

float taperControl = ch("taperControl");

float twistControl = ch("twistControl");

float velocityMagnitude = ch("velocityMagnitude");

float velocityDirection = ch("velocityDirection");

int prevPoint = -1;

int firstPoint = -1;

for (int i = 0; i < numPoints; ++i) {

float t = (float)i / (float)(numPoints - 1);

float angle = 2.0 M_PI turns * t;

float taper = 1.0 - t * taperControl;

radius *= taper;

angle += 2.0 M_PI twistControl * t;

vector position;

position.x = radius * cos(angle);

position.y = radius * sin(angle);

position.z = t * height;

vector noise = set(0, 0, 0);

noise = rand(i) noiseScale noiseAmplitude;

position += noise;

vector tangent = normalize(set(radius -sin(angle), radius cos(angle), height));

// Calculate the velocity along the tangent

vector velocity = tangent * velocityMagnitude;

int pt = addpoint(geoself(), position);

if (prevPoint >= 0) {

int line = addprim(geoself(), "polyline");

addvertex(geoself(), line, pt);

addvertex(geoself(), line, prevPoint);

} else {

firstPoint = pt;

}

float curveu = t;

setpointattrib(geoself(), "curveu", pt, curveu);

float density = fit01(rand(i), 0, densityControl);

setpointattrib(geoself(), "density", pt, density);

setpointattrib(geoself(), "v", pt, velocity);

prevPoint = pt;

}

removeprim(geoself(), 0, firstPoint);

gasField code:

float speedThreshold = chf("Speed_Threshold");

float minSpeed = chf("Min_Speed");

float maxSpeed = chf("Max_Speed");

float noiseScale = chf("Noise_Scale");

float directionX = chf("Direction_X");

float directionY = chf("Direction_Y");

float directionZ = chf("Direction_Z");

speedThreshold = clamp(speedThreshold, minSpeed, maxSpeed);

vector velocityNoise = set(0, 0, 0);

if (length(@vel) > speedThreshold) {

vector noise = noise(@P * noiseScale);

velocityNoise = set(noise.x directionX, noise.y directionY, noise.z * directionZ);

}

@vel += velocityNoise;

Add to cart
Size
1.62 MB
Copy product URL