Houdini Resources

Updated on June 26  2024


Wrangle Node Examples

Deborah R. Fowler



Wrangle Node Example - Fizz Buzz

Posted on Jan 21  2018


A popular programming example is Fizz Buzz. Since I assign this in two of my courses, one using hscript and the other C++ I will not show those solutions, however I thought it would be fun to replicate it using a point wrangle node. The hscript version can be completed in 3 nodes, here I have a few other nodes.

This is for those of you who are learning vex snippets in wrangle nodes. Video version on Vimeo

For those who have not heard of Fizz Buzz, it is described on wiki as a children's game and by some as a drinking game. It is also a very popular interview test.

The solution I will describe is based on the following rules:
Missing image

The network for the solution with a point wrangle node (which may look different from your hscript solution):
MISSING IMAGE
POINT WRANGLE: Focusing on the pointwrangle to provide the attributes required:
MISSING IMAGE
Detail (only once) rather than points means the code will be executed once instead of the default which iterates over all points

The icon that looks like a slider creates parameters on the node for user input. You can use the various types by specifying chi for integer, chf for float, chramp for ramp etc.

The pts[] is a list of the points and we will be associating attributes with each point and these can be seen in the geometry spreadsheet.

Next we iterate or "loop" through the points using a for loop and add the attributes associated with each point for position, phrase, and color:
MISSING IMAGE
click here for version from my vimeo video

COPY NODE:

Now on the copy node, we can easily kMISSING IMAGEeep these attributes by



MISSING IMAGEIn the Stamp tab we will set the Attribute Stamps to "phrase" which contains our phrase needed in the font node

Check on Pack Geometry so that only one packed geo is copied to the points

FONT NODE:

MISSING IMAGE In the Font node

Use the stamps function to return a string and backticks to convert to string type
`stamps("../copy1","phrase",0)`


DELETE NODE:

MISSING IMAGE The delete node is required so that the points are not displayed

NULL NODE:

MISSING IMAGE The Null node is added as a "good practice" in Houdini to delineate the bottom of your network for reference in other nodes






CAM NODE:

MISSING TEXT
Here I reference the bbox values in the camera so that if other tables of numbers are created the camera will adjust automatically

There are similar expressions in the Transform x and y to center the table