Home Reference VEX 

VEX functions

See VEX contexts to learn about the different contexts (such as surface shaders or displacement shaders) in which the various functions and statements are available.

Subtopics

Takes the derivative of the given value with respect to U.
Takes the derivative of the given value with respect to V.
Returns the absolute value of the argument.
Returns the arc-cosine of the argument.
Adds or changes a point attribute.
Adds the particle specified by point_number to the group specified.
Adds the mapping of the attribute aname to the local variable vname.
Returns the default name of the alpha plane (as it appears in the compositor preferences).
Returns the color of ambient light in the scene.
These functions are similar to the Worley noise functions listed above.
Computes the shading area of the variable.
Returns the arc-sine of the argument.
An efficient way of extracting the components of a vector, vector4, matrix3 or matrix to float variables.
Returns the arc-tangent of the argument.
Returns the arc-tangent of y/x.
Converts a string to a float.
Converts a string to an integer.
Computes attenuated falloff.
Returns the average of the vector’s 3 components
binput returns bilinear sampled input.
phong, blinn, and specular return the illumination for specular highlights using different lighting models.
Bump maps will return the color gradient of the image in the du/dv parameters.
Returns the default name of the bump plane (as it appears in the compositor preferences).
Returns the smallest integer greater than or equal to the argument
Evaluates a channel (or parameter) and return its value.
Returns the end sample of the input specified.
Returns the frame corresponding to the last sample of the input specified.
Returns the time corresponding to the last sample of the input specified.
Returns the value of a channel at the specified sample in an input.
Returns the channel name of the indexed plane.
Returns the number of channels in the input specified.
Returns the sample rate of the input specified.
Returns the start sample of the input specified.
Returns the frame corresponding to the first sample of the input specified.
Returns the time corresponding to the first sample of the input specified.
cinput returns point sampled input.
Computes a Catmull-Rom (Cardinal) spline between the key points specified.
Returns value clamped between min and max.
clip the line segment between p0 and p1.
There are various forms for looking up a color from a disk image.
Returns the default name of the color plane (as it appears in the compositor preferences).
In the POP and SOP contexts, sets how/whether to recompute normals. In the shading contexts, computes normals.
Concatenate all the strings specified to form a single string.
Returns the cosine of the argument.
Returns the hyperbolic cosine of the argument.
Depending on the value of c, returns the translate (c=0), rotate (c=1), or scale (c=2) component of the transform (xform).
Returns the cross product between the two vectors
Computes a Catmull-Rom (Cardinal) spline between the key points specified.
Returns the argument from radians into degrees
The depthmap functions work on an image which was rendered as a z-depth image from mantra.
Returns the default name of the depth plane (as it appears in the compositor preferences).
computes the determinant of the matrix
Returns the diffuse (Lambertian) illumination given the normalized surface normal.
computes the rotation matrix which rotates the vector a onto the vector b.
Imports a variable from the displacement shader for the surface.
Returns the distance between the two 3 or 4 dimensional point arguments.
Returns the squared distance between the two 3 or 4 dimensional point arguments.
Returns the dot product between the arguments.
Returns the color of the environment texture.
Returns the exponential function of the argument.
Sends a ray from the position P along the direction specified by the direction D.
Sends a ray from the position P along direction D.
Returns the anti-aliased weight of the step function.
finput returns fully filtered pixel input.
Takes the value in the range (omin, omax) and shifts it to the corresponding value in the new range (nmin, nmax).
Returns the largest integer less than or equal to the argument
Returns the fractional component of the floating point number.
Computes the fresnel reflection/refraction contributions given an incoming vector, surface normal (both normalized), and an index of refraction (eta).
Transforms a position from normal device coordinates to the coordinates in the appropriate space.
If dot(I, Nref) is less than zero, N will be negated.
Sends rays into the scene and returns information from the shaders of surfaces hit by the rays.
Sets two vectors to the minimum and maximum corners of the bounding box for the entire geometry.
Returns the blurred point position (P) vector at a fractional time between frames.
Returns the bounding box of the geometry specified by the filename.
Extract a single component of a vector, vector4, matrix3 or matrix.
Returns the depth of the ray tree for computing global illumination.
Returns the name of the current light when called from within an illuminance loop.
Returns the point index of the neighbour of the point.
Returns the number of points that are connected to the specified point.
Returns the name of the current “object” whose shader is being run.
Returns the depth of the ray tree for the current shading.
Returns an approximation to the contribution of the ray to the final pixel color.
Returns the gradient of a single channel texture image at the position specified by P.
Returns 1 if the plane specified by the parameter exists in this COP.
hscript_noise, hscript_turb, hscript_snoise, and hscript_sturb mimic the Houdini expression functions noise(), snoise(), turb(), and sturb().
Produces the exact same results as the Houdini expression function of the same name.
Convert HSV color space into RGB color space.
Returns the aspect ratio of the specified input.
Returns the channel name of the indexed plane of the given input (e.
computes identity matrices
Returns the last frame of the specified input.
Returns the end time of the specified input.
Returns 1 if the specified input has a plane named 'planename'.
Loops through all light sources in the scene, calling the light shader for each light source to set the Cl and L global variables.
Imports attribute data from the SOP or POP connected to the specified input.
Returns 1 if the particle specified by the point number is in the group specified by the string.
if the argument is negative, this returns ceil(x), otherwise it returns floor(x).
This function will “integrate” the 3d image along the line specified by p0 and p1.
The integrate3dClip function integrates along the ray described by p0 and p1 where “interesting” things start happening in a given I3D texture.
This function computes the intersection of the specified ray with the geometry.
This function intersects a ray (with it’s origin at p0 and extending to p1), against a 3d texture image.
Returns the number of planes in the given input.
inverts the matrix.
Returns the index of the plane named 'planename' in the specified input.
Returns the name of the plane specified by the planeindex of the given input (e.
Returns the number of components in the plane named 'planename' in the specified input.
Returns the frame rate of the specified input.
Computes irradiance (global illumination) at the point P with the normal N.
Parameters in VEX can be overridden by geometry attributes (if the attributes exist on the surface being rendered).
Returns 1 if input_number is connected, or 0 if the input is not connected.
Returns 1 if the shader is being called to evaluate illumination for fog objects, or 0 if the light or shadow shader is being called to evaluate surface illumination.
Returns 1 if the Vex CHOP’s Unit Menu is currently set to 'frames', 0 otherwise.
Returns 1 if the Vex CHOP’s Unit Menu is currently set to 'samples', 0 otherwise.
Returns 1 if the Vex CHOP’s Unit Menu is currently set to 'seconds', 0 otherwise.
Returns 1 if the shader is being called to evaluate opacity for shadow rays, or 0 if the shader is being called to evaluate for surface color.
Returns the starting frame of the specified input.
Returns the start time of the specified input.
Returns the X resolution of the specified input.
Returns the Y resolution of the specified input.
Returns an interpolated value along a spline curve.
Returns the length of the vector or vector4.
Returns the squared distance of the vector or vector4.
Performs bilinear interpolation between the values.
Imports a variable from the light shader for the surface.
Computes a linear spline between the key points.
Returns the natural logarithm of the argument
Returns the logarithm (base 10) of the argument
computes a rotation matrix to orient the z-axis along the vector (to-from) under the transformation.
Computes a linear spline between the key points.
Compute the luminance of the RGB color specified by the parameters
Returns the default name of the luminence plane (as it appears in the compositor preferences).
Builds a 3×3 or 4×4 transform matrix.
Returns the default name of the mask plane (as it appears in the compositor preferences).
This function returns 1 if the subject matches the pattern specified, or 0 if the subject doesn’t match.
Returns the value of the point attribute for the metaballs if metaball geometry is specified to i3dgen.
Returns the density of the metaball field if metaball geometry is specified to i3dgen.
Once you get a handle to a metaball using metastart and metanext, you can query attributes of the metaball with metaimport.
Takes the ray defined by p0 and p1 and partitions it into zero or more sub-intervals where each interval intersects a cluster of metaballs from filename.
Open a geometry file and return a “handle” for the metaballs of interest, at the position p.
Returns the metaweight of the geometry at position p.
Transforms the position specified into the “local” space of the metaball.
Creates a new group in which to put particles.
Reads a pixel and its eight neighbors into a 3×3 matrix.
There are two forms of Perlin-style noise: a non-periodic noise which changes randomly throughout N-dimensional space, and a periodic form which repeats over a given range of space.
Returns the normalized vector
Returns the default name of the normal plane (as it appears in the compositor preferences).
Returns the number of primitives in the geometry file.
The nrandom() functions are non-deterministic random number generators for VEX.
See ptransform.
Computes ambient occlusion.
These functions are similar to wnoise and vnoise.
Returns the transform associated with an OP.
otransform, ltransform, ftransform, ontransform, lntransform, fntransform, ovtransform, lvtransform, and fvtransform query the scene for a geometry object, light or fog object of the given name.
Transforms a normal vector from Object to World space.
Transforms a position value from Object to World space.
Transforms a direction vector from Object to World space.
This function closes the handle associated with a pcopen function.
Writes data to a point cloud inside a pciterate or a pcunshaded loop.
Returns the distance to the farthest point found in the search performed by pcopen.
Filters the points found by pcopen using a simple reconstruction filter.
Imports channel data from a point cloud inside a pciterate or a pcunshaded loop.
This function can be used to iterate over all the points which were found in the pcopen query.
Returns a handle to a point cloud file.
Iterate over all of the points of a read-write channel which haven’t had any data written to the channel yet.
Writes data to a point cloud file.
phong, blinn, and specular return the illumination for specular highlights using different lighting models.
Generates a new diffuse photon path randomly distributed over the hemisphere defined by P and N, with energy Cl.
Generates a new specular photon path defined by the ray starting at P and travelling along R (the reflection direction) with energy Cl.
Stores a photon in the appropriate maps.
Takes three arguments which represent the probabilities for each of the reflective paths.
Generates a new transmission photon path defined by the ray starting at P and traveling along R (the reflection direction) with energy Cl.
The photonmap function will evaluate a photon map and return the resulting color information.
Returns the index of the plane specified by the parameter, starting at zero.
Returns the name of the plane specified by the index (e.
Returns the number of components in the plane (1 for scalar planes and up to 4 for vector planes).
There are two forms of Perlin-style noise: a non-periodic noise which changes randomly throughout N-dimensional space, and a periodic form which repeats over a given range of space.
Returns the default name of the point plane (as it appears in the compositor preferences).
Raises the first argument to the power of the second argument
Evaluates the attribute string att for primitive pn at the parametric location u, v.
Returns the normal of the primitive (prim_number) at parametric location u, v.
Prints values to the console which started the VEX program.
This function returns the closest distance between the point Q and a finite line segment between points P0 and P1.
Transforms a vector from one space to another.
Converts a quaternion represented by a vector4 to a matrix3 representation.
Multiplies two quaternions and returns the result.
Creates a vector4 representing a quaternion.
Converts the argument from degrees into radians
generate a random number based on the position in N dimensional space (where N is 1 to 4 dimensions).
Sends a ray from the position P along the direction D.
Imports a value sent by a shader in a gather loop.
Returns the vector representing the reflection of the direction against the normal.
Computes the amount of reflected light which hits the surface.
Returns the refraction ray given an incoming direction, the normalized normal and an index of refraction.
Computes the illumination of surfaces refracted by the current surface.
Returns the relative position of the point given with respect to the bounding box of the entire geometry.
Removes the particle specified by point_number from the group specified.
Queries the renderer for a named property.
Convert RGB color space to HSV color space.
Rounds the number to the closest integer.
applies a rotation to the given matrix.
scales the given matrix in three directions simultaneously (X, Y, Z - given by the components of the scale_vector).
These two functions provide a very efficient way of creating a vector/vector4.
These functions set a single component of a vector, vector4, matrix3 or matrix.
Calls shadow shaders for the current light source.
The shadowmap function will treat the shadow map as if the image were rendered from a light source.
Imports a variable from the shadow shader for the surface.
Imports a variable sent by a surface shader in an illuminance loop.
Returns the sine of the argument
Returns the hyperbolic sine of the argument
Yields processing for a certain number of milliseconds.
Quaternion blend between q1 and q2 based on the bias.
Computes a number between zero and one.
These functions are similar to wnoise.
phong, blinn, and specular return the illumination for specular highlights using different lighting models.
specularBRDF, phongBRDF, blinnBRDF, and diffuseBRDF return the computed BRDFs for the different lighting models used in VEX shading.
Returns an interpolated value along a polyline or spline curve.
Formats a string like printf but returns the result as a string instead of printing it.
Returns the square root of the argument
Returns the length of the string.
Returns the trigonometric tangent of the argument
Returns the hyperbolic tangent of the argument
Imports attributes from texture files.
Computes a filtered sample of the texture map specified.
Returns the value of the 3d image at the position specified by P.
This function queries the 3D texture map specified and returns the bounding box information of the file.
Transforms a position into normal device coordinates.
Sends a ray from P along the normalized vector D.
translates the given matrix
transposes the given matrix
Transforms a normal vector from Texture to World space.
Transforms a position value from Texture to World space.
Transforms a direction vector from Texture to World space.
Returns the default name of the velocity plane (as it appears in the compositor preferences).
Voronoi noise gives almost identical results to the Worley noise functions.
Calculates the volume primitive’s gradient.