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.
-
Takes the derivative of the given value with respect to the 3rd axis, for volume rendering.
-
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.
-
Returns the area of the micropolygon containing a variable such as P.
-
Efficiently creates an array from its arguments.
-
Returns the length of an array.
-
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.
-
Transforms between color spaces.
-
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.
-
Reads the z-records stored in a pixel of a deep shadow map or deep camera map.
-
Returns the emissive component of a bsdf.
-
Returns the color of the environment texture.
-
Evaluates a bsdf given two vectors and a normal.
-
Runs light shaders for a light and exports evaluated information.
-
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.
-
Extracts a single component of a vector type, matrix type, or array.
-
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, or converts an integer light ID into the light’s name.
-
Returns an array of light identifiers for the currently shaded surface.
-
Returns the point index of the neighbour of the point.
-
Returns the number of points that are connected to the specified point.
-
Returns an array of the point numbers of the neighbours of a point.
-
Returns the name of the current “object” whose shader is being run.
-
Returns the integer ID of the light being used for photon shading.
-
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.
-
Exports the shadow scope and categories for a given light.
-
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 an estimate of a light’s contribution to the overall scene lighting.
-
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.
-
Interpolates a value across the currently shaded micropolygon.
-
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.
-
Finds the nearest intersection of a ray with any of a list of (area) lights.
-
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 whether a given light is “distant” (an environment light or directional light) .
-
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.
-
Returns an initialized sampler sequence for use as the first argument to the nextsample function.
-
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.
-
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).
-
Removes the last element of an array and returns it.
-
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.
-
Adds an item to an array.
-
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.
-
Sets the length of an array.
-
Convert RGB color space to HSV color space.
-
Rounds the number to the closest integer.
-
applies a rotation to the given matrix.
-
Samples a bsdf.
-
Returns the 3D position of a point on an area light.
-
scales the given matrix in three directions simultaneously (X, Y, Z - given by the components of the scale_vector).
-
Flattens an array of vector or matrix types into an array of floats.
-
These two functions provide a very efficient way of creating a vector/vector4.
-
Sets a single component of a vector type, matrix type, or array.
-
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.
-
Bit-shifts an integer left.
-
Bit-shifts an integer right.
-
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 the approximate proportion of specularity in a bsdf.
-
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
-
Stores exported data on a light.
-
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.
-
Turns a flat array of floats into an array of vectors or matrices.
-
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.
-
Returns the volume of the microvoxel containing a variable such as P.
-
Calculates the volume primitive’s gradient.
-
Samples the volume primitive’s value.
-
See ptransform.
-
Worley noise scatters points randomly through space (according to a nice Poisson distribution).
-
Transforms a normal vector from World to Object space.
-
Transforms a position value from World to Object space.
-
Transforms a direction vector from World to Object space.
-
Transforms a normal vector from World to Texture space.
-
Transforms a position value from World to Texture space.
-
Transforms a direction vector from World to Texture space.