VEX Attribute Glossary - kunz
Conditionals
> //Greater than
< //Less than
>= //Greater than or equal to
<= //Less than or equal to
!= //Not equal to
== //Is equal to
&& //And
|| //Or
Channel Shortcut Syntax
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
Global Variables
// Available in all SOP wrangles
f@Frame //The current floating frame number, equivalent to the $FF Hscript variable
f@Time //The current time in seconds, equivalent to the $T Hscript variable
i@SimFrame //The integer simulation timestep number ($SF), only present in DOP contexts.
f@SimTime //The simulation time in seconds ($ST), only present in DOP contexts.
f@TimeInc //The timestep currently being used for simulation or playback.
// Available in Attribute Wrangle (point, vertex, primitive and detail)
v@P //The position of the current element.
i@ptnum //The point number attached to the currently processed element.
i@vtxnum //The linear number of the currently processed vertex.
i@primnum //The primitive number attached to the currently processed element.
i@elemnum //The index number of the currently processed element.
i@numpt //The total number of points in the geometry.
i@numvtx //The number of vertices in the primitive of the currently processed element.
i@numprim //The total number of primitives in the geometry.
i@numelem //The total number of elements being processed.
// Available in Volume Wrangle
v@P //The position of the current voxel.
f@density //The value of the density field at the current voxel location.
v@center //The center of the current volume.
v@dPdx, v@dPdy, v@dPdz //These vectors store the change in P that occurs in the x, y, and z voxel indices.
i@ix, i@iy, i@iz //Voxel indices. For dense volumes (non-VDB) these range from 0 to resolution-1.
i@resx, i@resy, i@resz //The resolution of the current volume.
Common Geometry Attributes
// Int
@id // A unique number that remains the same throughout a simulation.
// Float
@pscale // Particle radius size. Uniform scale. Set display particles as 'Discs' to visualize.
@width // Thickness of curves. Enable 'Shade Open Curves In Viewport' on the object node to visualize.
@Alpha // Alpha transparency override. The viewport uses this to set the alpha of OpenGL geometry.
@Pw // Spline weight.
// Vector3
@P // Point position. Used this to lay out points in 3D space.
@Cd // Diffuse color override. The viewport uses this to color OpenGL geometry.
@N // Surface or curve normal. Houdini will compute the normal if this attribute does not exist.
@scale // Vector scale. Allows directional scaling or stretching (in one direction).
@rest // Used by procedural patterns and textures to stick on deforming and animated surfaces.
@up // Up vector. The up direction for local space, typically (0, 1, 0).
@uv // UV texture coordinates for this point/vertex.
@v // Point velocity. The direction and speed of movement in units per second.
// Vector4
@orient // The local orientation of the point (represented as a quaternion).
@rot // Additional rotation to be applied after orient, N, and up attributes.
// String
@name // A unique name identifying which primitives belong to which piece. Also used to label volumes.
@instance // Path of an object node to be instanced at render time.
Common Functions
abs(x) // Absolute value: abs(-5) = 5
normalize(v) // Unit vector: normalize({3,4,0}) = {0.6,0.8,0} normalizes length to one
length(v) // Vector length: length({3,4,0}) = 5
distance(p1,p2) // Distance between two points
dot(v1, v2) // Dot product of two vectors
cross(v1, v2) // Cross product (returns vector perpendicular to both)
pow(x, y) // x raised to power y
sqrt(x) // Square root
sin(x), cos(x), tan(x) // Trigonometric functions
clamp(value, min, max) // Keeps value between min and max
fit(value, old_min, old_max, new_min, new_max) // Remaps from one range to another
fit01(value, new_min, new_max) // Remaps 0-1 to new range
smooth(value, min, max) // Smooth step function (S-curve)
lerp(a, b, t) // Linear interpolation: lerp(0, 10, 0.5) = 5
slerp(q1, q2, t) // Spherical interpolation for quaternions
reflect(incident, normal) // Reflection vector
refract(incident, normal, eta) // Refraction vector
Specifying VEX Data Types
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.
DOP Particle Attributes
f@age // Time in seconds since the particle was born.
f@life // Time in seconds the particle is allowed to live. When f@age>f@life, i@dead will be set to 1.
f@nage // Normalized age, f@age divided by f@life. Implicit attribute, you cannot write to this.
i@dead // Whether a particle is living (0) or dead (1). A dead particle is deleted in the Reaping stage.
i@id // A unique id for the particle that remains the same throughout a single simulation.
i@stopped // Whether a particle is moving (0) or stopped (1).
i@stuck // Whether a particle is free (0) or stuck (1).
i@sliding // Whether a particle is free (0) or sliding along a surface (1).
f@cling // Force applied to sliding particles inwards (according to the collision's surface normal).
s@pospath // The path to the object that the particle is colliding with.
i@posprim // Which collision primitive in the path geometry whose position we wish to refer to.
v@posuv // Parametric uv on the collision primitive.
i@hittotal // The cumulative total of all hits for the particle (only incremented once per timestep).
i@has_pprevious // This is set to 1 if v@pprevious contains valid values.
v@pprevious // Stores the position of the particle on the previous frame. Used for collision detection.
i@hitnum // The number of times the particle collided in the last POP Collision Detect.
s@hitpath // The path to the object that was hit. A path to a file on disk or an op: path.
i@hitprim // The primitive hit. Could be -1 if it the collision detector couldn’t figure out which prim.
v@hituv // The parametric UV space on the primitive.
v@hitpos // Where the hit actually occurred. Useful if the colliding object was moving.
v@hitnml // The normal of the surface at the time of the collision.
v@hitv // The velocity of the surface at the time of the collision.
f@hittime // When the collision occurred, that could be within a frame.
f@hitimpulse// Records how much of an impulse was needed for the collision resolution. varies with timestep.
f@bounce // When particles bounce off another object, this controls how much energy they keep.
f@bounceforward // Controls how much energy they keep in the tangential direction.
f@friction // When particles bounce, they are slowed down proportional to how hard they hit.
s@collisionignore // Objects that match this pattern will not be collided.
f@force // Forces on the particle for this frame.
f@mass // Inertia of the particle.
v@spinshape // This is multiplied by f@pscale to determine the shape of the particle for rotational inertia.
f@drag // How much the particle is effected by any wind effects.
f@dragexp // Ranges from 1 to 2, default is set on the solver. Used for both angular and linear drag.
v@dragshape // How much the particle is dragged in each of its local axes.
v@dragcenter// If specified, drag forces will also generate torques on the particle.
v@targetv // The local wind speed. Thought of as the goal, or target, velocity for the particle.
f@airresist // How important it is to match the wind speed. Thickness of the air.
f@speedmin // Minimum speed, in units per second, that a particle can move.
f@speedmax // Maximum speed, in units per second, that a particle can move.
p@orient // Orientation of the particle. Used for figuring out 'local' forces.
v@w // Angular speed of the particle. A vector giving the rotation axis.
v@torque // The equivalent of force for spins. No inertial tensor (the equivalent of mass) is supported.
v@targetw // The goal spin direction and speed for this particle.
f@spinresist// How important it is to match the targetw.
f@spinmin // Minimum speed in radians per second that a particle can spin.
f@spinmax // Maximum speed in radians per second that a particle can spin.
DOP Grains Attributes