Houdini Resources

Updated on March 26  2017


Tips and Tricks (list)

copyright  Deborah R. Fowler

Houdini Webinars

Deborah R. Fowler



Wrangle Nodes

Updated on Sept 12  2016

See Wrangle Node Examples


Posted on Aug 25  2013
 

Below is my summary highlighting some essential facts from the Sidefx webinar on Wrangle Nodes by Ari Danesh.


These are cool - a "coded" point node in a sense. ie. you are manipulating point data
VEX - Vector Expression - very fast, C++ and RSL like

What is that @ symbol doing in Vex?

The wrangle node snippets are very much like vex with less high level constructs. The webinar focusses on the differences (and they look more like mel by introducing the @ ) however ...
do not be alarmed by the notation introduced at the start of the webinar.

@ is like a fetch - it's fast
For example:

@P +={0,2,0};            

would add this value to every point P. Recall P is position (look at your global variables in VOP if you've forgotten). So if you put the above expression in the VEX snippet of a wrangle node, it will move every point of the geometry connected up 2 units in y).

@ can be used to define variable with (look very mel like here). Below is a vector P1 defined to be (0,2,0)

v@P1 = set(0,2,0);

Just like in VEX (and C++) you have to declare the types and they are shortened in the Wrangle nodes.

You can also add parameters the usual way, using the parameter interface editor, and reference them using ch. Note that $PT does not work, you have to say @P

Here are the comparisons of parameter types in VEX and Wrangle:

In VEX
In Wrangle snippet
int
i
float
f
vector
v  or v4
string
s

Examples:
f@spam = 3.0;
v@eggs = set(0,2,0);


This would give you a float variable spam with value 3.0 and a vector size three with value (0,2,0).

In an example, define user parameters translatey, noiseamp and seed on the object node. Put the code below into a point wrangle node to act on a grid - tah dah - a mountain like node.


v@P1 = set(0,ch("../translatey"),0);
f@randy = random(@ptnum * ch("../seed"));
v@randv = set(0,@randy * ch("../noiseamp"),0);
@P+= @P1 + @randv;

Try it! (if you cut and paste, watch out for the " marks)

When you look at the details view, you will see that randv, P1 and randy are all attributes. That is something the @ does.
It saves you from having to use a create attribute node. However, if you do not want that, just use temporary variables just as you normally would in vex. ie. you can use vector rather than v@


Rewriting the above so no new attributes are created we would have:

vector P1 = set(0,ch("translatey"),0);
float randy = random(@ptnum * ch("seed"));
vector randv = set(0,randy * ch("noiseamp"),0);
@P+= P1 + randv;

This produces the same results, but no new attributes are created (check the details view).
Sample hip here.

NOTE: C++ is very useful for understanding VEX.

For a list of functions available in vex, type
vcc -X sop
in a terminal shell (note for those on Windows - go to All Programs/SideEffectsSoftware/Your version/CommandLineTools
This will open a window similar to unix's terminal shell for Houdini).

The next part of the webinar continues with examples and talks about building a Lissajous curve and discusses briefly a book about Generative Design by Harmut Bohmaker.