Houdini VEX sink
SideFX Houdini VEX #note/sink #code/vex
Vectors
@v = {1, 1, 1}
v@v = set(x, y, z)
VEX Snippets
parm*=rand(@id+38+ch("seed"));
random number, linear spread
parm=fit01(rand(@id+31+ch("seed")),ch("min"),ch("max"));
particle age -> Ease in - Ease out
parm*=smooth(ch("start"), ch("end"),@nage);
parameter change in a certain time range
parm=fit(@Frame, ch("start"), ch("end"), ch("start_value"), ch("end_value"));
connect params
parm=fit(@P.y, ch("low"), ch("high"), ch("low_value"), ch("high_value"));
param from age by multiplier
parm*=chramp("parm",@nage);
param from a particle speed
parm=fit(length(@v),ch("speedmin"),ch("speedmax"), ch("valuemin"), ch("valuemax"));
Specifying VEX Data Types
The following characters are used to cast to the corresponding data type.
float f@name // Floating point scalar values.
vector2 u@name // Two floating point values. Could be used to store 2D positions.
vector3 v@name // Three floating point values. Usually positions, directions, normals, UVW or colors.
vector4 p@name // Four floating point values. Usually rotation quaternions, or color and alpha (RGBA).
int i@name // Integer values (VEX uses 32 bit integers).
matrix2 2@name // Four floating point values representing a 2D rotation matrix.
matrix3 3@name // Nine floating point values representing a 3D rotation matrix or 2D transform matrix.
matrix 4@name // Sixteen floating point values representing a 3D transform matrix.
string s@name // A string of characters.
Channel Shortcut Syntax
This is used to hint at the data type of auto generated wrangle parameters.
ch('flt1'); // Float
chf('flt2'); // Float
chi('int'); // Integer
chv('vecparm'); // Vector 3
chp('quat'); // Vector 4 / Quaternion
ch3('m3'); // 3x3 Matrix
ch4('m4'); // 4x4 Matrix
chs('str'); // String
chramp('r', x); // Spline Ramp
vector(chramp('c', x)); // RGB Ramp