Referencing another parameter on the same node:

  1. Right click -> copy parameters from the source parameter box
  2. Right click -> paste relative references in the destination parameter box

Note that you can copy/paste all the components of a parameter by performing this action on the name instead.

You can do this manually by typing ch(“nameofparameter”) into the parameter box. You can find the parameter name in an info box by hovering over its display name. Eg. hover over transform nodes “Rotate” to display:

Rotate
_______________
Parameters: rx ry rz
Amount of rotation about xyz axes

So to reference the x rotation value you would type ch(“rx”)

Referencing another parameter on a different node:

You can reference other node’s parameters in exactly the same way

  1. Right click -> copy parameters from the source node’s parameter box
  2. Right click -> paste relative references in the destination node’s parameter box

In this case the formula contains a relative path to the original node

Eg. ch(“../transform_node2/rx”)

Description for this block. Use this space for describing your block. Any text will do. Description for this block. You can use this space for describing your block. Description for this block. Use this space for describing your block. Any text will do. Description for this block. You can use this space for describing your block.

The help documentation for each node will give you some of its specific local variables. These vary from node to node but a reasonable generic list for geometry is outlined below.

If you are unsure of the name for a Local variable type $ into a parameter box to see a list of all possible variables.

HScript vs VEX

The original expression language of Houdini is HScript. The variables that start with $ belong to HScript. However this is gradually being replaced by VEX which is the language used to manipulate attributes and create your own nodes. VEX is more powerful, but for legacy reasons much of HScript remains. VEX variables start with an @ symbol. As you can see below, sometimes HScript is just a lot easier to use:


ExpressionVEX
Current frame$FF or @Frame@Frame
Current time$T or @Time@Time
Bounding box$BBX, $BBY, $BBZrelbbox(0,@P).x, relbbox(0,@P).y, relbbox(0,@P).z
Centroid$CEX, $CEY, $CEZvector cent = getpointbbox_center(0);// cent.x, cent.y, cent.z
Size$SIZEX, $SIZEY, $SIZEZvector size = getbbox_size(0);// size.x, size.y, size.z
Corners$XMIN, $YMIN, $ZMIN, $XMAX, $YMAX, $ZMAXvector min; vector max;getbbox(0, min, max);// min.x, min.y, min.z, max.x, max.y, max.z

Description for this block. Use this space for describing your block. Any text will do. Description for this block. You can use this space for describing your block. Description for this block. Use this space for describing your block. Any text will do. Description for this block. You can use this space for describing your block.

Using Random Values

HScript expression: rand(seed), VEX: random(seed)

You can use either. The seed can be any value that changes as you need the values to change. For example use the point number (@ptnum) to change the values for every point. Use frame number ($F or $FF) to change the values over time.

rand(@ptnum), rand($FF)

The result of these is always between 0 and 1. If you want to change this range use: fit01(n, newmin, newmax) 

fit01(rand(@ptnum), -180, 180) 

Will give a different value between -180 and 180 for each point

You will find a lot more information on using Expressions, using random numbers in your expressions, and some interesting manipulations you can do using mathematical expressions in the Houdini documentation

http://www.sidefx.com/docs/houdini/ref/expression_cookbook.html

Using Variables

There are two types of Variables

LOCAL: these change depending on the node (eg. $CEX, $CEY, $CEZ- centroid of an object)

GLOBAL: these are general variables that are always available (eg. $F – current frame)

Some useful Local Variables

these reference on the whole object

$CEX, $CEY, $CEZThe centroid of the input
$GCX, $GCY, $GCZThe centroid of the input group
$XMIN, $XMAXThe X extents of the bounding box of the input
$YMIN, $YMAXThe Y extents of the bounding box of the input
$ZMIN, $ZMAXThe Z extents of the bounding box of the input
$SIZEX, $SIZEY, $SIZEZThe size of the bounding box of the input
@numptTotal number of points
@numprimTotal number of primitives
@numvtxTotal number of vertices

These reference the attributes of an object’s components 

@Pposition
@Nnormal
@Cdcolour
@Alphacolour’s alpha value
@uvuv coordinate
@ageage of a particle
@life% of total life used
@ptnumeach point’s number
@primnumeach primitive’s number
@vtxnumeach vertex’s number
@pscalepoint scale
$BBX, $BBY, $BBZpoint’s relative position in the bounding box.

Some useful Global Variables 

These mostly relate to time and rendering, so you are less likely to use them when creating procedural geometry

$FPSPlayback speed in frames per second
$FSTARTFrame number of the first frame of animation
$FENDFrame number of the last frame of animation
$FThe current frame
$FF, @FrameFloating point frame number
$NFRAMESNumber of frames in the animation.
$HIPThe directory containing the current scene file.
$HIPFILEThe full path of the current scene file, including the file extension.
$HIPNAMEThe name of the current scene file without the extension
$HOMEYour home directory.
$JOBThe project directory.
$PIThe mathematical constant pi (3.1415926…)

Lots more on Global Variables here:

http://www.sidefx.com/docs/houdini/network/expressions#variables-and-attributes

Join the Conversation

1 Comment

Leave a comment

Leave a Reply to Conrado Cancel reply

Your email address will not be published. Required fields are marked *