Referencing another parameter on the same node:
- Right click -> copy parameters from the source parameter box
- 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
- Right click -> copy parameters from the source node’s parameter box
- 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:
Expression | VEX | |
Current frame | $FF or @Frame | @Frame |
Current time | $T or @Time | @Time |
Bounding box | $BBX, $BBY, $BBZ | relbbox(0,@P).x, relbbox(0,@P).y, relbbox(0,@P).z |
Centroid | $CEX, $CEY, $CEZ | vector cent = getpointbbox_center(0);// cent.x, cent.y, cent.z |
Size | $SIZEX, $SIZEY, $SIZEZ | vector size = getbbox_size(0);// size.x, size.y, size.z |
Corners | $XMIN, $YMIN, $ZMIN, $XMAX, $YMAX, $ZMAX | vector 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, $CEZ | The centroid of the input |
$GCX, $GCY, $GCZ | The centroid of the input group |
$XMIN, $XMAX | The X extents of the bounding box of the input |
$YMIN, $YMAX | The Y extents of the bounding box of the input |
$ZMIN, $ZMAX | The Z extents of the bounding box of the input |
$SIZEX, $SIZEY, $SIZEZ | The size of the bounding box of the input |
@numpt | Total number of points |
@numprim | Total number of primitives |
@numvtx | Total number of vertices |
These reference the attributes of an object’s components
@P | position |
@N | normal |
@Cd | colour |
@Alpha | colour’s alpha value |
@uv | uv coordinate |
@age | age of a particle |
@life | % of total life used |
@ptnum | each point’s number |
@primnum | each primitive’s number |
@vtxnum | each vertex’s number |
@pscale | point scale |
$BBX, $BBY, $BBZ | point’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
$FPS | Playback speed in frames per second |
$FSTART | Frame number of the first frame of animation |
$FEND | Frame number of the last frame of animation |
$F | The current frame |
$FF, @Frame | Floating point frame number |
$NFRAMES | Number of frames in the animation. |
$HIP | The directory containing the current scene file. |
$HIPFILE | The full path of the current scene file, including the file extension. |
$HIPNAME | The name of the current scene file without the extension |
$HOME | Your home directory. |
$JOB | The project directory. |
$PI | The mathematical constant pi (3.1415926…) |
Lots more on Global Variables here:
http://www.sidefx.com/docs/houdini/network/expressions#variables-and-attributes
Just what i was looking for. Thank you!