Posts
Houdini VEX - Noise and Curves
In these examples, we have a line along +x and we use noise functions to distort it along the y-axis.
Inside a Wrangle over points:
float offset = 0; // This is zero for simplicity @P.y = sin(@P * @Time + offset); The combined term of @P * @Time is the frequency of the curves. The higher this number – as @Time increases – the greater the frequency.
We start with the simplest, using sin:
Posts
Houdini VEX - Random Directed Vectors
This is a great way of getting “random” vectors but you need the vectors to be “clamped” to a certain range of “spread”.
To illustrate this, we’ll use a buncha points on a grid and “shoot” (aka move) them out “randomly” using sample functions.
1. Sample Direction Uniform vector2 u = rand(@ptnum); @P = sample_direction_uniform(u); Which gets us, well, a buncha points scattered in every direction.
2. Sample Hemisphere This function takes a center and a bias.
Posts
Houdini - Max, Min, Average of Attributes
Without writing Vex, append an Attribute Promote and promote the attribute to a detail, then use any of the promotion methods:
In this case, we want the maximums of @P – so we promote from Original name - P - to a New name of max which lets us then access max as a detail attribute!
Posts
Houdini - Scatter With Attribute
We’ll take this png.
Use an Attribute from Map to populate @Cd with color information from the image.
Now we can Scatter by density, and use Cd to drive the density.
Black and transparent pixels are treated as zero density, hence, will have no scattering.
Posts
Houdini - Using Measure
We use a Measure SOP to get the perimeter of each Voronoi fractured piece, then set that value as @pscale.
Copy to Points will pick up @pscale and apply it to every instance hence the bigger the piece, the bigger the instance.
Posts
Houdini - Multiplying Quaternions
From this exercise and the following lines:
vector4 o = dihedral({0, 0, 1}, @P); // align z-axis with @P vector We get this result:
Now we want to face her ass out, which means we gotta rotate her 90-degrees on her y-axis.
From this exercise, we learned how to build a quarternion from a rotation and an axis.
vector4 r = quaternion(set(0, radians(90), 0)); // e.g {0, 90, 0} - rotate y 90-deg We combine both the rotations by multiplying the quarternions, using qmultiply:
Posts
Houdini - Orientation
How Houdini determines orientation Houdini searches for these attributes, in this order. It goes down this list until none is found.
@orient attribute. Use this to orient copy/instances. Using @N as the Z-axis and +Y is up. Use @v e.g. velocity. If @rot exists, apply it to the above. Copy to Points We have a point with @N = {0, 1, 0} e.g. its normal pointing up (the yellow trail).
Posts
Houdini - Quaternions From Rotation and Axis
float deg = radians(@Frame % 360); @orient = quaternion(set(deg, 0, 0)); Substituting set(0, deg, 0) - Y-axis.
Substituting set(0, 0, deg) - Z-axis.
Posts
Houdini - Connecting Points on a Geometry
Lets start with a mesh like this (with points colored cause why not).
Keep only Points Use the Add operator (yes, use the “add” operator to remove stuff) like this:
To get just the points!
Remove faces, keep Points and Edges So we wanna remove the “primitive faces” but keep the points and edges (edges are technically primitives in Houdini). We can use:
Convert Lines Carve Ends - Close U > Unroll with New Points.
Posts
Houdini - Selecting Points on a Grid
Using neighbourcount in a Group Expression operator to get points on the outer edge of a grid:
neighbourcount(0, @ptnum) <= 3 To get only the corners:
neighbourcount(0, @ptnum) == 2