Houdini Resources

Updated on June 26  2024


Wrangle Node Examples

Deborah R. Fowler



Wrangle Node Example - Do you want to build a Snowman?

Posted on April 7  2018


Corresponding video here

Yes I want to build a snowman ... in Houdini! I love wrangle nodes. I wanted to build a snowman much like I had on my tips and tricks page - but this time not with hscript but with a point wrangle!

If you are new to Houdini, the following examples are an introduction to procedural modeling. Building objects relative to each other so that changes can be easily made and expanded. Rules, expressions, and ultimately code can make the process easy.

I will go through 3 cases. These are all contained in the hipnc file from 16.5.268 called buildingSnowmen.hipnc

Building a simple snowman

If you were to build a simple snowman, the first thing you want to do is place a sphere on the ground. This is a basic operation we use all the time - to make the center point relative to the size. So for example, on a sphere we use the expression ch("rady") * ch("scale")


MISSING IMAGE

If it were a box, we would use the expression ch("sizey") * .5 * ch("scale"). Note that ch("sizey") * .5 is the same as saying ch("sizey") / 2

Next we make the spheres that are added on top, relative to the first sphere. Note because they are spheres we multiply by 2 to get there size. If this was a box, we would use sizey.
There are a number of ways to do this, but you are essentially adding up the size (height) of the objects below.

MISSING TEXT

This works, but if you want to make a multi-sphere snowman, you continually have to add more nodes. So of course, in comes the copy node. Now if the sphere were all the same size, $CY * diameter or $CY * 2 * radius would work.
However, the problem is, if the spheres are differing in size, you need to know what the distance in y from the center is for a given sphere. That is easy, you just add up the previous ones - but where do you store that information? So we need to calculate it.
This used to be done using for loops in hscript and is here for completeness as we move to the point wrangle node.

Hscript Snowman

Here we are shrinking each consecutive sphere. In the copy node we are calculating the distance in the sum.
MISSING IMAGE

Point Wrangle Snowman

Finally, the best solution is to use the point wrangle. We do the same thing but in the point wrangle node with points and define pscale.

MISSING IMAGE

We can even go one step further and have tiers of increasing snowballs. Not very snowman like but perfect for a building. As above but in the pow function divide i by how many in a row you want the same.

MISSING IMAGE

Here is it in the case of a tower as well.


MISSING IMAGE