Thread Net with VOP

Let’s make some thread swirling around and make a net.

Firstly, we create a grid and keep only points.

We then use VOP to generate v (velocity) that we can later use it in POP to drive particle.

Spherical waves

Here’s the note that i would like to share with you to make spherical waves by Houdini using vex to create a sphere from a grid and project wavy lines on to the surface.

Concept:

Make some wavy lines on a 2D Plane 🠒 Project them onto a Sphere (which is made from the 2D Plance) 🠒 Create Stripes based on the generated waves.

Make waves

  • To generate some 2d waves, we start by create a grid (in this example, i set up the grid orientation as ZX plane and connectivity as Columns).
  • Next, we keep just the first Column by Delete SOP.
  • Apply Resample Node with Maximum Segments of 13 (so we have 14 points on the line).
  • Wrangle 01 – create waves by transform the position of P.x
float overall_speed = ch("overall_speed");
float leading_wave_speed = ch("leading_wave_speed");
@P.x += @Time * overall_speed;
if (@ptnum % 3 == 2)
{
    @P.x += @Time * leading_wave_speed;
}
@P.x = clamp(@P.x,-5.0,5.0);
  • The wave is now formed but it’s sharp. Therefore, we smooth it by convert the line to Nurb.
  • Use Trail SOP to offset-clone the waves we’ve just made.
  • We project the waves on to 2D grid by using vex function intersect
vector project_dir = chv("project_dir");
vector project_points;
vector uvw;
int primid = intersect(1, @P, project_dir, project_points, uvw);

if (primid >= 0)
{
    @P = project_points;
    @N = prim(1, "N", primid);
}

v@project_prim = primid;
v@project_uv = uvw;
  • Now we convert the flat 2D Grid to sphere by writing vex code as follow:
vector relbox = relbbox(0,v@P);
float u = relbox.z;
float v = relbox.x;
float rad = ch("radius");
u *= (2*$PI);
v *= $PI;
float x = rad * sin(v) * cos(u);
float y = rad * sin(v) * sin(u);
float z = rad * cos(v);
v@P = set(x,y,z);
  • Let’s put the 2D waves into first input of the Wrangle and the Sphere into the second and project the waves into the spherical geometry:
v@P = primuv(1, "P", i@project_prim, v@project_uv);

SOP: Distance from Geometry

Distance from Geometry (geometry node)

Function: Measure distance between each point and a reference geometry

Example:

  • Scatter some points on a grid and plug to Attribute Geometry of distancefromgeo SOP
  • Type a text and wire to Reference Geo of the SOP
  • Set Distance Metric to Distance from Surface
  • Promote dist attribute to max and min detail
  • Write a wrangle to remap the dist attribute
float max_dist = detail(1, 'max_dist');
float min_dist = detail(2, 'min_dist');
@dist = fit(@dist, min_dist, max_dist, chf('min_dist'), chf('max_dist'));
float dist_ramp = chramp('dist_ramp', @dist);
@dist *= dist_ramp;'

Modulus

Modulus operator returns the r value (remainder) after dividing a with b

r = a % b

for example:

  • r = 7 % 5; r = 2;
  • r = 5 % 5; r = 0;

Use modulus to choose odd or even number

In this example, we got a polygon circle and we choose only points with odd numbers and push them out to turn a circle into a star shape.

if (@ptnum%2==1) {
    @P += @P*ch("amount");
}

Use modulus operator to cycle value

To cycle the value in Carve node, we can use:

experession in First U: fit(@Time%4,1,4,0,1)

experssion in Second U: fit(@Time%4,0.1,3.5,0,1)

Add a foreach loop to create the offset for carving.