Houdini Fundamentals: Parameters overview

In Houdini anything you can change in a node’s parameters pane counts as a parameter. Pretty self-evident. So how complex can this be? Why does it need any explanation at all? You change the Universal scale on a box or sphere and the size changes. You change the colour with a Color node and the colour changes. Indeed, if everything is static in your scene and you don’t mind placing objects by hand then you can move on.


The parameter pane for your box geometry outlined in red

Still here? Good. The fact is that changing these parameters is something you’ll want to do an awful lot in Houdini and changing them over time is central to animation. I know of four ways to change parameters in Houdini and suspect there are more. They are listed here in brief and it’s my intention to write a more detailed article for most with plenty of examples of common tasks. They are:

By hand

As mentioned above you can type in numbers, move sliders and change colours etc. with your mouse and keyboard. Not much more to say here apart from mentioning some common shortcuts. If you middle click and hold on a numeric field a ladder will appear. Move your mouse to a value and move left or right and your parameter will go up and down by that value. It’s really handy.

If you middle click on a field with Ctrl held down you reset it to default.

Changing the uniform scale parameter by hand

Keyframing

A common concept in animation software is keyframing – which my dictionary tells me needs to be hyphenated. I think it looks ugly so will continue to type it without.

Animation is done by frames, usually 24,25 or 30 frames per second (FPS) depending on your broadcast medium. Keyframing lets you set a value of a parameter at one frame, set a different value at another frame and have Houdini interpolate between them.

So we set the x to 0 at frame 0 and x to 10 at frame 24 and set the animation playing our object will move 10 units in the positive x direction over 24 frames. If your animation runs at 24 FPS that will be one second.

Just about any parameter may be keyframed at will. You can change the nature of the interpolation (linear is a straight change over time, bezier can be used for “ease-in” and “ease-out” effects, etc.)

The easiest way to create a keyframe is to move the animation slider to the frame you want to set the keyframe on, change the parameter as you wish and alt-click on it. You will see it turns green to signify it is keyframed.

There is a lot more to keyframing which we will come to later.

Here I’ve set the Center X parameter to 0 on frame 0
And here at frame 24 I’ve set Center X to 10

MotionFX

MotionFX is a useful adjunct to keyframing that is used for a variety of tasks where you may not want to create every keyframe by hand. It enables you to take your keyframes and add cycling, or noise, or easily change the ease-in or-ease out of your keyframes and a lot more.

You do this by creating whatever keyframes you want then right clicking on the parameter, moving down to MotionFX and selecting the effect you want to create. This will then open up the MotionFX window which shows the effect you’ve just created as a line/curve that describes the value as it changes over time.

Here I’ve set up a third keyframe at frame 48 that moves Center X back to 0 – I’ve selected the keyframes by holding shift while left clicking and moving the mouse
By right clicking on the Center X parameter I open the menu, hover over MotionFX and then select Cycle
The MotionFX window will open up – this shows how the parameter (underlined in red) changes over time.
If I zoom out using the mouse wheel you can see that now the parameter cycles those keyframes repeatedly both before and after the originals
And here we have our box moving backwards and forwards along x

Channel Operations

In Houdini terms what we’ve created with our keyframing or MotionFX of a parameter is called a channel. Houdini has it’s own network type devoted to changing channels over time called Channel Operators or CHOPs.

If you followed the section above on MotionFX you’ll have noticed that what it actually did is create a new CHOP Network at the level of our box. You can double click to enter the CHOP network and have a look at what it’s made.

A CHOP Network created by MotionFX
Inside the CHOP Network

I won’t get into how this works, that’s for a more detailed look. But know that you can create your own CHOP network and use a lot of different nodes to control how your channels change over time. Most of the time however you’ll create them automatically by using either MotionFX or various shelf tools.

Code Snippets

Finally we move away from keyframe based operations and enter the land of computer programming (coding). I’m not much of a coder and you don’t have to be either to get by in Houdini. You may either learn that specific snippets do certain things, learn by copying other people’s code from tutorials or bite down and chew to learn Houdini coding from scratch. It’s up to you how far down the rabbit hole you want to go.

In Houdini there are three different languages available to you: HScript, Vex and Python. The first two are Houdini specific and the latter is an industry standard language. Though Houdini is increasingly shifting from HScript to Vex in specific nodes for it’s speed HScript is the language we will currently we dealing with in the context of this article.

It’s impossible to teach you how to code in this article so I’ll limit myself to a couple of examples so you get the general flavour. By default Houdini centers objects at 0,0,0 – the origin – but let’s say you want your object to always sit on the floor (y=0). What you want to do is to take the height of the object and set the Ty parameter to half of that height. And you want it to be “live” so that if you change the size of your object it remains on the floor.

The code to insert into your Ty parameter is:

ch("sizey")/2 // for a cube
ch("scale")/2 // for a sphere
ch("height")/2 // for a cylinder

Houdini references parameters in this way: ch(“param_name”) and the /2 means divide by two.

To view Houdini’s coding name for a parameter hover over the field and they are listed
Here a sphere will always sit on ty=0 by putting the underlined code into it’s field

What about animation? How do we rotate an object using HScript? Houdini lets us access various global variables and use them in our code. One of the most useful for animation is the $F variable which will always evaluate to the current frame number.

$F // put this in one of the rotate axes
$F * 360/240 // this will rotate once per 240 frames
$F * 360/$NFRAMES // this will rotate once for the length of your animation
$F * 360/$NFRAMES * 3 // this will rotate three times over the length of your animation
Our torus rotates three times over our animation length

Another thing you may often want to do is move an object back and forth along one of the axes. The mathematical functions Sine or Cosine are ideal for this.

sin($F) // placed in some transform axis will move it back and forth 
sin($F*8) // will change the speed
sin($F*6) * 0.5 // changes the speed and controls the amount of movement
sin($F*6) * 0.5 + 2 // this adds an offset of two

In general we can use the formula: sin(frame_number*speed)*distance+offset to make any parameter change back and forth over time.

The torus moves up and down over time thanks purely to the underlined code in the ty axis

As you can see these simple little snippets of code can help us do a lot in Houdini and are very handy. I keep a list of them in a text file as and when I come across something that seems useful. The online documentation at www.sidefx.com is excellent and another resource you should be looking at often.

Conclusion

Here I must end this rather lengthy overview of Houdini Parameters. Hopefully you’ve got a broad overview of what they are and what you can do with them.

Leave a Reply