Since I was making circuit looking stuff I tried a different approach above, and in doing so had to explore setting random points into a group via Vex. Enter the setpointgroup function, very handy indeed. This snippet creates a group of random points based on a threshold, and is useful enough to take note of:
Here’s another super-simple trick you can perform with the dot product of two vectors. If you create two nulls and get the vector between them, you can compare that with the vector from any point to the first null using a dot product. Any value less than zero is past the plane of the first control normal to the second. That doesn’t read well, but the result is straightforward, you are using the controls to act like a normal and cull points.
Furthermore, the distance between those two nulls acts as a handy scale factor to color points in a gradient between the two. Here for instance we’ve “cut” a sphere in half…
The structure is very simple as you can see in the network view. The wrangle is also very simple. Thanks to Tokeru for inspiration and the basic structure of this wrangle.
vector p1, p2, v1, v2;
p1 = point(1,'P',0); //control null 1
p2 = point(2,'P',0); //control null 2
v1 = normalize(p2-p1);
//vector between control nulls
v2 = @P-p1;
//vector from current eval point to control 1
f@angle = dot(v2, v1);
//The dot product of the two, indicates 'perpendicularity'
if (@angle <= 0){
removepoint(0,@ptnum);}
//Cull out any points past p1
float dist = distance(p1,p2);
@Cd = dot(v2,v1)/dist;
//The distance between the two can also act as a gradient
This works, but there’s a far simpler approach to take using the matrix transforms mentioned a few posts earlier. Transform the points to the origin of a control object’s local space (you saved that wrangle as an asset, right?) and then you can use very simple logic – in this case let’s delete any point greater than zero in z.
if ( @P.z > 0) {
removepoint(0,@ptnum);
}
Translate the points back to their original world position (in that other wrangle you saved as an asset, right?) and bam, you have a super easy tool to cull points according to a control object. Or make a gradient, or whatever else you want.
Ok, so Houdini. Like most people I found the initial experience daunting. Cinema 4d is like a warm blanket, Houdini is completely the opposite having a lot of cryptic nodes to learn, many of which have evolved far beyond what they were first intended to do. Being a proceduralist that part of Houdini was amazing to first explore, but there’s a lot of ground to cover and caveats everywhere that can only be worked through by getting hands-on with every inch of this software.
Wheee! This is both fun and completely daunting.
But ok, I’m getting comfortable. VOPs was a no brainer for an ICE guy so I started there and that quickly turned me on to VEX and lovely attribute wrangles. First up, let’s make some lines, and then make some spirals. W00T.
Yep, phyllotaxis and phi resurface. Same concepts, new toolset. For a while I’ll be covering similar ground to prior posts as I rebuild much of my ICE production toolset as Houdini Assets. Now I have a set of .hip assets to create different kinds of spirals, connect lines to points and the like. Stuff in everyone’s toolbox I would think… should I share simple stuff like that here? I’ll probably make a wrangle cheatsheet for little stuff like this and share that.