Not everything in Houdini is VEX. Parameter fields evaluate HScript expressions, and this cheatsheet collects the ones you use most - channel references, frame and time math, padding and geometry reads.
Channel references
| Expression | Note |
|---|---|
ch("../transform1/tx") | Read a channel from another node by relative path. |
chramp("myramp", $F/100) | Evaluate a ramp parameter at a 0..1 position. |
chexist("../ctrl/gain") ? ch("../ctrl/gain") : 1 | Fall back to a default when the channel may not exist. |
Frame and time
| Expression | Note |
|---|---|
$F / $FF | Current frame (integer) / fractional frame. |
$T | Current time in seconds = ($F - 1) / $FPS. |
sin($T * 360) * 2 | HScript trig is in DEGREES, unlike VEX. One cycle per second. |
padzero($F, 4) | Zero-pad the frame for file names, e.g. 7 becomes 0007. |
Reading geometry
| Expression | Note |
|---|---|
point("../box1", 0, "P", 0) | point(surface, point_num, attrib, index) - index 0/1/2 is x/y/z. |
prim("../grid1", 0, "Cd", 0) | Primitive attribute value (the R channel here). |
npoints("../merge1") | Number of points on the referenced SOP. |
HScript vs VEX: when to use each
Use HScript expressions in parameter fields - a channel, a frame-driven value, a file name. Use VEX in wrangles to process geometry per element at speed. A common trap: HScript trig works in degrees while VEX works in radians, so sin() behaves differently in each. For the variables these expressions reference, see the global variables reference; for per-element geometry work, use the VEX snippets.
Frequently asked questions
What is the difference between HScript and VEX?
HScript expressions evaluate in parameter fields for single values like a channel or frame; VEX runs in wrangles to process geometry per element at high speed.
Why does sin() give different results in HScript and VEX?
HScript trigonometric functions use degrees, while VEX uses radians. Convert with radians() in VEX, or feed degrees to HScript.