Featured Artist: Johnny Farmfield, Sweden
My name is Johnny Farmfield and I live and operate out of Gothenburg, Sweden. I started out as a photographer in the late 1980s, but I quickly shifted into working with any and all things related to computer graphics. I’m currently split between doing industrial-scientific visualizations and freelance compositing and FX work.
LEARNING TO LEARN HOUDINI
Working with Attributes
Channeling my inner John Kasich, I will start with a random anecdote. Some 20+ years ago, living in a hut on the beach in Dahab, Egypt, I ran into Scott, a professional pool player from Wales. We started talking about the game and with my science background I of course started talking about trigonometry and linear algebra . . . Scott just gave me this annoyed look and said - I don't know #$%# about physics or math, but I played a lot of pool.
And that’s how we learn most things in life, you just start playing around with something, try different things, figure them out, try this and that, and with each step you learn something new. Eventually you figure out what works and what doesn't. Keep it up for some 10.000 hours and you can step into a courtroom witness stand and call yourself an expert.
TRIAL AND INEVITABLE ERROR
Starting out with Houdini, the first impulse will be using the shelf tools - and sure, they are a great way to create basic networks, something to jump into and start digging around, break them down the best you can. It’s a great way to start exploring Houdini.
The problem is, the second things stop behaving as you expect them to, you will instantly be lost.
So, thinking about my own experience, what did I learn from migrating to Houdini - which insights would have benefited me the most to have learnt earlier?
Getting into how to work with attributes is a great start. My hope is that, when you get a better understanding on how to work with attributes, it’s going to be much easier to understand the Houdini workflow in general and how it differs from other 3D applications.
THE HOUDINI MINDSET
Let’s go back to the basics of 3D. Take an object, be it a simple sphere or a particle system: It is the sum of its parts. And it’s not that we don’t know this, but how often do you really think about it?
Numbered points, primitives and normals (left) and Pinhead from above (right)
The same goes for manipulating objects. Take a common task like displacing a flat surface with a noise texture. Do you ever think about what is actually happening? How the noise color is data and how you are using the data values to move the points?
Looking back at my years using different 3D applications, I of course knew the 3D objects I created were constructed from points, curves, polygons, etc, but I never really thought about it. Until I had to. Similarly, doing something like a noise displacement, though I knew what was happening, technically, I rarely thought about it - until I had to.
But migrating to Houdini I quickly became aware I had to actively start thinking about these things. I realized I needed to change my mindset and start looking at objects as the result of their individual parts - and from there approach how to manipulate those parts.
I believe this mindset is essential in Houdini.
WHAT’S (THE) A POINT
So we all know how everything in a 3D application is built from points. An edge is (at least two) points connected by a curve. A polygon (somewhat confusingly called “primitives” in Houdini) is three or more connected points representing a surface. And so on.
But what is a point? I mean, really?
Well, in its simplest form, a point is just a position, one value per axis to define its location in 3D space. If a point doesn’t have a position, it doesn’t exist. To paraphrase Descartes - I have a position, therefore I am.
0.0.0 - Congratulations! You are the center of the universe!
This simple realization is important in Houdini because it leads us to the concept of attributes - and how they are an integral part of the Houdini workflow.
A point attribute is just data connected to a point. As you need a position to define a point and you need to keep track of the point in relation to other points, the fundamental attributes of a point are its position and its point number.
In Houdini, a point technically doesn’t need anything else. With the default settings, Houdini’s renderer Mantra will even render it as a white dot.
Now, when you have a point, you can attach any type of data to that point as an attribute. The most common attributes are of course the ones generated by different nodes, like color, velocity, group membership, but there are really no restrictions on what type of data we write into an attribute.
OTHER ATTRIBUTE CLASSES
Point attributes are only one of several classes of attributes in Houdini; you also have vertex, primitive and detail attributes.
Point and primitive attributes essentially work the same way. Vertices are a subclass of points, grouped by polygon, and vertex attributes are mostly used for UV mapping and surface normals.
Then there’s detail attributes. Detail attributes are not connected to any geometry; they instead apply to the whole object. They are among other things used for variable mapping of attributes. I’ll get a bit into variables and aliases later on.
Depending on the type of data to be stored in an attribute there are also different data types, the most common being integer, float and vector.
The point number is an integer, a whole number, so you can stop looking for point 3.6 right now. A float is a floating point value, so if there were a point 3.6, its data type would be a float. An example of a vector is velocity, three float values give it a direction and a magnitude.
And note that, though an attribute consisting of three floats isn’t necessarily a vector, for anything defined by three floats, you can use the vector data type. Take position. It’s technically not a vector, but say you want to store the position of a point for a specific frame, you would still use the vector attribute type, as a position is defined by three floats, one for each axis. The same goes for color. Like a position, color isn’t a vector, but as it is three floats, creating an attribute to store color data, you can just use the vector data type.
Now, if you become so attached to a point that you want to give it a name, there’s also a string attribute type.
VIEWING ATTRIBUTE DATA
Due to how integral attributes are to the Houdini workflow, access to the attribute values is essential. This is where the spreadsheet comes in. Now, for just checking which attributes an object has at a specific time, middle clicking any node will pop up an info box which lists everything from groups to attributes in the stream.
But as you often want to check the actual values, you have the spreadsheet. You can access it by right clicking a node and choosing spreadsheet from the pop up; this will open the spreadsheet as a separate window. You also have a spreadsheet pane in the main Houdini (default-) layout and you can place it wherever you want, if you create a custom window/layout preset.
Sure, it looks about as interesting as a phone book, but when you get into the Houdini workflow, you will pretty quickly realise how important easy access to the attribute values is.
You can also use the spreadsheet to do this - if you are a crazy person
AUTOMATED ATTRIBUTE USE
Because working with attributes is so fundamental to the Houdini methodology, a lot of node parameters automatically inherit specific attribute values as default,.
Take the polywire SOP, used to mesh curves. If the points on the curve have a pscale attribute, this will automatically be used for the wire diameter. Here’s an example where I created a curve out of a particle trail. I shifted and remapped the particle age attribute to the pscale attribute as well as to the color attribute, using a color ramp to control the color. When I attach the polywire SOP, the resulting mesh automatically uses the pscale for the width and inherits the point colors.
Some nodes, like the copy SOP, can use more than one attribute for the same functionality. Here I manually randomized the pscale- and point normal attributes on a static point cloud. The cone is copied to each point, is automatically scaled using the pscale attribute and orients to the point normal.
But if you feed a particle system into the copy, using the same cone, it will automatically orient the cone using the velocity attribute, as shown below.
This type of automation is of course very handy and it is implemented in many SOP’s where the use of normals, velocity, width and scale parameters, etc, are inherited automatically . . .
If you don’t want to have these parameters inherit the point attributes, in some nodes, like the copy, it’s easy to uncheck “use point attributes”, but in nodes like the polywire SOP, where that option is not available, the easiest solution is to use an attribute delete SOP before the polywire and just strip that data out.
ATTRIBUTE DATA IS DATA IS DATA
Unless he’s Lore, of course.
This is an essential realisation. Data stored in an attribute is just data. How you use it is in no way constrained to its label, and the data is easily shifted from one attribute to another - even on a component level, like shifting one component of a vector to a float attribute.
Here’s an example where I added some random colored noise on a plane. Adding an attribute wrangle SOP and simple VEX scripting, I use the green color value to displace the points in Y.
And you can of course do it the other way around. Here is the same displaced mesh where I first colored the mesh black, then shuffled the point position in Y into the green color channel.
Using color for visualisation like this is a simple and useful trick commonly used in Houdini. Another common trick is using point normals to store or visualize vector values.
Attributes can be transferred between objects; the most common way is by distance. Here’s an example where I transfer the color from the blue to the red sphere using a gradual transition.
Attribute transfer by distance using a soft transition.
Another example is controlling the strength of glue constraints between pieces of a fractured object. The glue constraints have a strength attribute to determine their breaking point and you can use attribute transfer to dissolve constraints based on their distance from a control object.
Aside from distance, there are numerous other ways to transfer attributes in Houdini. For particles and fluid simulations there are a lot of custom nodes for accomplishing this.
Here is a setup I created for a simple vortex. I used an attribute VOP to create normals on a point cloud.
After that I converted the point cloud to a volume, shifting the point normals into velocity. Then, in DOP’s, I used the functionality intended for advecting particles with fluids to transfer the velocity to a grain simulation.
And as with any setup in Houdini, this is in no way the “correct” way to set something like this up. There are always multiple solutions, but it was a solution I used for this particular setup.
Attribute promotion is the method for moving or copying attributes from one attribute class to another.
Point color attribute on the left, promoted to primitive color on the right.
Lets look at our attribute transfer example again. Here I transfer the color from one object to the other, just as I did previously. But instead of using the data for color, I shift the data in the blue color channel to a separate attribute, then I promote that attribute to a primitive attribute.
Now I can use that per primitive attribute value to extrude each primitive separately. The amount of extrusion will be controlled by the distance to the blue sphere.
And at this point I’m hoping that you are starting to understand the power of this workflow. The possibilities for using attributes in Houdini are infinite.
GUI ATTRIBUTE CONTROL
Whatever node you create in Houdini, any value that controls what that node does or how the attributes are changed is called a parameter.
But as with attributes, in Houdini, you are not locked into the default parameters, you also have the possibility to edit and add to any node settings pane using the node gear menu, choosing ‘edit parameter interface’.
This functionality is in some cases automated. An example is, if you add a ramp in a VOP SOP sub network, its control parameters (and GUI) will automatically be “promoted” up to the settings pane for the VOP SOP. You also have buttons for promoting up parameters in most VOP SOPs, the reason being that it quickly becomes impractical to jump in and out of sub networks to tweak the values.
Here is a setup inside an attribute VOP SOP. I use the primitive number to transform each primitive in Y by adding it to the Y value. To control the amount, I add a multiply operator between the primitive number and the add operator. I middle click the second input and chose ‘promote parameter’ and now Houdini will automatically create a float parameter and add it to the settings GUI for the VOP SOP.
VARIABLES AND ALIASES
An alias or a variable are references to something else, like an attribute or a parameter. Any attribute or parameter in Houdini can be mapped as an alias or a variable.
The default variables in Houdini are the global variables. An example of global variables is $HIP, which is mapped to the current scene file folder path.
Though variables are still used throughout Houdini, for some things they are being replaced by aliases. While variables are defined by a dollar sign and caps, as in $F for the current frame number, aliases (like attributes in VEX) are defined with an at sign, as in @Frame for the current frame number.
This VEX snippet will move incoming points in X by 1 unit per frame.
There are also global variables, default variable mapping, for several common attributes - like $P, mapped to the position attribute, etc… Note that Houdini in some areas is moving away from attribute variable mapping and in many cases the preferred method now is to use the VEX type @P, @P.x, @P.y, @P.z… For more detailed information about this and for a complete list of global variables, check the Houdini help file.
Well, we have reached the end of this introduction to attributes in Houdini. And this is of course only a sliver of information in regard to using and manipulating attributes, just an introduction to push you in the right direction.
But there’s an immense amount of information on all of this on the web. Tons of tutorials, blog posts, reference material, etc. Just as I’m finishing this article, Matt Estela just published an amazing breakdown on points, primitives and vertices on his blog (see HERE).
For Houdini tutorials in general, on the non commercial side, Peter Quint has a very comprehensive set on Vimeo covering various techniques. For math in Houdini, nothing beats the Vizy Acky videos from Garman Herigstad. All his tutorials are now available on Youtube for free. Amazing stuff.
On the commercial training side, my personal favourites are Rohan Dalvi and Adam Swaab. There also a lot of good courses on specific subjects from FXPHD, cmiVFX, CG Society, among others . . .
There are also a couple of great forums to get help when you get stuck, like Side Effects’ own Houdini forum and my favourite, OD|Force forums.
ADDENDUM - NOMENCLATURE
There are a lot of Houdini specific terms, these are only the ones I used in this text.
SOP - Surface OPerator: A node for manipulating the points or primitives on an object.
DOP - Dynamics OPerator: A node that contains a dynamics network.
POP - Particle OPerator: From Houdini 13, POPs are a DOP preset with a basic particle system set up inside.
VEX - Vector EXpressions: Houdini’s expression language.
VOP - Vector OPerator: A visual programming sub network type for setting up VEX expressions without coding.
Attribute Wrangle: A node where you use VEX code snippets for manipulating attribute data.
Johnny Farmfield 2016
By: Patricia Cornet