Houdini 20.5 VEX VEX Functions

trace VEX function

Sends a ray from P along the normalized vector D.

On this page
Context(s) shading

Disambiguation: The VEX function to compute the trace of input matrix is tr.

void  trace(vector &cv, vector &of, float &af, vector P, vector D, float shadow_bias, float max_contrib, ...)

Sends a ray from ‹P› along the normalized vector ‹D›. The resulting color, opacity and alpha will be put in the export variables.

shadow_bias› is typically a small number which is used to prevent self-shading.

max_contrib› controls how much the result of the trace() call will contribute to the resulting pixel color. ‹max_contrib› has no effect on the results of the trace() call.

int  trace(vector pos, vector dir, float time, ...)

Sends a single ray into the scene at time and retrieves information from the hit surface. A return value of 1 means the ray hit a surface.

Only the second signature accepts any of the following variadic arguments. The first trace signature is more specific, and is legacy from older versions of mantra.

Light inclusion/exclusion options

"categories", string ="*"

Specifies lights to include/exclude by their “category” tags. This is the preferred include/exclude lights rather than pattern matching light names with the "lightmask" keyword argument.

For example:

diff = diffuse(nml, "lightmask", "hero | fill");

See light categories for more information.

"lightmask", string ="*"

When evaluating light and shadow shaders, objects have pre-defined light masks. This mask is usually specified in the geometry object and specifies a list of lights which are used to illuminate a surface or fog shader. It is possible to override the default light mask by specifying a “lightmask” argument.

For example:

diff = diffuse(nml, "lightmask", "light*,^light2");

…will cause all lights whose names begin with “light” except for a light named “light2” to be considered for diffuse illumination.

All Houdini scoping patterns, excepting group expansion, are supported:

  • * - wild-card match

  • ? - single character match

  • ^ - exclusion operator

  • [list] - character list match

Area sampling options

For area sampling, you must specify both the angle and sample variadic parameters. For example:

surface
blurry_mirror(float angle = 3; int samples = 16; float bias=0.05)
{
    Cf = reflectlight(bias, 1, "angle", angle, "samples", samples);
}

Ray options

Tip

When you specify a texture, such as with the "environment" keyword, you can also use the image filtering keyword arguments. See environment for a listing of the image filter keyword arguments.

"scope", string

A list of objects which can be hit by the rays. When specified, scope overrides the default scope that would have been selected for the given raystyle. The "scope:default" value will cause the scope argument to use the default scope for the current context - as if the argument were not specified.

Allows an override of the scope for ray-intersections. A special scope argument, scope:self, will match the currently shading object.

"currentobject", material

Used to specify what the current shading object is. For example, when used with the scope argument, scope:self will match the object passed in by this argument.

"maxdist", float =-1

The maximum distance to search for objects. This can be used to limit the search of objects to nearby objects only. If the maxdist given is negative, then it will act as if there is no maximum distance.

Allows an override of the maximum distance the ray can travel when testing for intersections. Some functions (such as fastshadow) have the maximum distance implicitly defined (by the length of the ray) and should probably avoid using this option. However, this option can be used effectively when computing reflections, global illumination, refraction etc.

"variancevar", string

The name of a VEX export variable to use for variance anti-aliasing. The renderer compares the value with adjacent micropolygons in micropolygon rendering to decide what shading points need additional samples (using vm_variance property as a threshold). If more samples are required, the algorithm takes samples up to the specified maximum ray samples.

This variable must be imported from the hit surface, so it must be in the list of imported names (see “importing information back from the ray” below). If the named variable is not imported, this option will be ignored.

Variance antialiasing puts more samples in areas of the image with high variance, for example a sharp shadow edge. It is only used when vm_dorayvariance is enabled. Otherwise, only the min ray samples (or an explicitly supplied "samples" value) are used for antialiasing of the gather loop.

Overrides the global variance control (mantra’s -v option) which is used to determine anti-aliasing quality of ray tracing. For more information please refer to the documentation on mantra.

"angle", float =0

The distribution angle (specified in radians). For gather(), rays will be distributed over this angle. For trace(), the angle is used to indicate the rate at which the filter width should increase with increasing intersection distance. Larger angles will cause farther hit surfaces to use larger derivatives, leading to improved texturing and displacement performance.

To be effective, the samples parameter should also be specified.

"samples", int|float =1

How many samples should be sent out to filter rays. For the irradiance and occlusion functions, specifying a samples parameter will override the default irradiance sampling.

"environment", string

If the ray sent out to the scene misses everything, then it’s possible to specify an environment map to evaluate.

Using the ray’s direction, the environment map specified will be evaluated and the resulting color will be returned. Most likely, it will be necessary to specify a transform space for the environment map evaluations.

In the case of refractlight and trace the Of and Af variables will be set to 0 regardless of the background color specified. the resulting color.

When an environment map is specified, the filtering options from texture() are also supported.

See how to create an environment/reflection map.

"envobject", string

If an environment map is used, the orientation of the environment map can be specified by transforming the ray into the space of another object, light or fog object in the scene. In Houdini, null objects can be used to specify the orientation. For example:

Cf = R*reflectlight(bias, max(R), "environment", "map.rat", "envobject", "null_object_name");

"envlight", string

If an environment map is used, the orientation of the environment map can be specified by transforming the ray into the space of a light in the scene.

"envtint", vector

If an environment map is used, tint it with this color.

"background", vector

If a ray misses all objects, use this as the background color of the scene. In the case of refractlight and trace the Of and Af variables will be set to 0 regardless of the background color specified.

"distribution", string

Functions: irradiance, occlusion

Distribution for computing irradiance. The default is to use a cosine distribution (diffuse illumination). The possible values for the style are "nonweighted" for uniform sampling or "cosine" for cosine weighted sampling.

Ray sending options

"width", float =-1

Specifies the filter width at the source of the ray. If angle is also specified, the filter width will become larger with increasing distance along the ray. By default, the filter width will be initialized from the current shading context, so it’s normally not necessary to specify width directly. Negative values are ignored and will also cause the filter width to be initialized from the current shading context.

"distribution", string ="cosine"

Determines the sampling distribution.

For gather:

  • cosine – Rays are distributed by the cosine (diffuse) function over the hemisphere.

  • uniform – Rays are distributed uniformly over the hemisphere

For sample_geometry:

  • area – Samples are distributed by primitive area

  • parametric – Samples are distributed by primitive ID, subdivision ID, and parametric surface coordinates (s, t).

  • solidangle – Samples are distributed either by primitive area or by primitive area and solid angle subtended by the primitive.

"biasdir", vector =Ng

Overrides the bias direction when Bias Along Normal is enabled. When no biasdir is specified, the geometric normal Ng is used. When bias along normal is disabled, this option has no effect.

"SID", int =0

Sample identifier to be passed to the called shader. If the calling shader has used SID to generate samples, it can be useful to pass the modified sample identifier to the called shader so that it can begin sampling at the specified offset. This value will be used to initialize the SID global in the hit surface.

"rayweight", float =1

A hint to mantra to indicate the relative contribution of this ray to the final shading. This value is used by the ray clip threshold to limit sending of rays (similar to ray bounce).

"raystyle", string ="refract"

The type of rays you are sending. Mantra will use raystyle to determine both the default raytracing mask and bounce limit used for ray termination.

  • reflect – Sending reflection rays. Mantra will use the reflection mask and reflection limit to terminate raytracing.

  • refract – (default) Sending refraction rays. Mantra will use the refraction mask and refraction limit to terminate raytracing.

  • diffuse – Sending diffuse rays. Mantra will use the diffuse limit for diffuse rays.

  • shadow – Sending shadow rays. Mantra will not modify the raytracing level and will trace against shadowmask if inside a shadow or light shader.

  • primary – Sending primary rays. This style can be used when a shader needs to change the direction of a primary ray without affecting the behavior of render settings that apply only to directly visible objects (such as matte and phantom). Mantra will still increment the raytracing level when sending primary rays.

  • nolimit – Sending reflection rays with no limit on the number of raytracing bounces. Mantra will still increment the raytracing level when sending nolimit rays.

"categories", string

A category expression used to select the objects which can be hit by rays. When specified, this overrides the existing reflectcategories and refractcategories parameters.

For example, ^hidden will hit all objects which do not have the hidden category, and shiny|happy will hit all objects with either the shiny or happy category.

The intersection of the scope and categories parameters are used to choose the objects which can be hit by rays.

"samplebase", float =0

Typically, rays are distributed over the surface of the micro-polygon being shaded. This argument can be used to control the area. A value of 0 will force all rays to be sent from the same point. A value of 1 will cover the entire micro-polygon. (Gather only)

"transparentsamples", int =1

The number of transparent samples to take for stochastic transparency with array outputs. Normally this value should be set to 1 unless you have requested exports in array variables - in which case the ray tracer will insert an entry in the array for each sample along the ray.

Note

transparentsamples must be 1 when importing F or ray:material using screendoor samplefilter.

Sending information to the surface’s shader

Using a keyword in the form "send:‹name›", value, you can pass data from the originating surface to surfaces which are intersected by the ray. These arguments pass any values you want.

gather(P, dir, "send:N", normalize(N)) { ... }

You can extract this passed data on the receiving end (that is, in the surface being hit by the ray) with the rayimport function. The first argument is the name (without the send: prefix) and the second argument is a variable in which to store the imported value.

int rayimport(string name, <type> &value)

rayimport returns 1 if the value was imported successfully.

Importing information from the ray

You can specify names of global or exported variables to import from the hit shader in the form "‹varname›", &var, typically including Cf (color vector of surface hit) and Of (opacity vector of surface hit).

vector  hitcf;
gather(P, dir, "bias", 0.01, "Cf", hitcf) {...}

In addition, you can import the following special keywords to get information about the ray itself:

"ray:origin", &vector

The origin of the ray (defined in else clause also).

"ray:direction", &vector

The direction of the ray (defined in else clause also).

"ray:length", &float

The distance to the first surface which was hit by the ray.

"ray:area", &float

The total surface area of all the geometry in the raytracing scope.

"ray:solidangle", &float

The estimated solid angle subtended by all geometry in the raytracing scope. For large objects close to or enclosing the ray origin, this may be a very poor estimate while for individual primitives the estimate can be very good.

You can retrieve information about more than one hit along the ray by requesting data in an array variable. When an imported value is of an array type, the trace function will automatically append an entry in the array for each individual hit point that was composited during ray tracing. For the opacity sample filter (see below), an entry will be created in the array for each semi-transparent sample encountered until full opacity is reached. When using array outputs, it may also be useful to use the all sample filter, which will cause all hits along the ray to be inserted regardless of whether the opacity limit was exceeded.

// Find the position and normal for all hit points along the ray,
// regardless of visibility.
vector a_pos[];
vector a_nml[];
trace(P, dir, Time,
        "samplefilter", "all",
            "P", a_pos,
            "N", a_nml);

Sample filtering options

By default, Houdini composites the global variables using opacity blending. In some cases, it’s more useful to get the value from the closest surface (regardless of whether it’s transparent). You can use the special samplefilter keyword with a string value of either closest or opacity to control whether the value of a global is from the closest surface or opacity blended.

"samplefilter", string

When the samplefilter keyword is encountered in the argument list, all following import variables will use the specified filtering mode. You can specify multiple samplefilter arguments in a single gather statement to filter different variables in different ways.

The current types of allowed for samplefilter are

minimum

Take the minimum value of all the samples. Note that with tuple values, the minimum value of each component will be used.

maximum

Take the maximum value of all the samples. Note that with tuple values, the maximum value of each component will be used.

opacity

Composite samples using the over operation.

closest

This is the default behavior, returning only the closest surface.

screendoor

Use stochastic compositing of the samples.

sum

Return the sum of the values for all samples.

sum_square

Return the sum of the squares of the values of all samples.

sum_reciprocal

Return the sum of the reciprocals of each sample.

Note

When using sample_geometry, the default samplefilter is set to closest by default, since opacity blending only works when compositing data along a ray.

gather(P, dir,
        "samplefilter", "opacity",
            "Cf", hitCf,
            "Of", hitOf,
        "samplefilter", "closest",
            "P", hitP,
            "N", hitN)
{
    trace(pos, dir, time,
            // Composite the bsdf of the hit surfaces using stochastic transparency
            "samplefilter", "screendoor",
            "F", hitF,
            // But find the closest sample's position
            "samplefilter", "closest",
            "P", hitP);
}

Pipeline options

"pipeline", string

As you specify variables, you can intersperse pipeline keyword options to control where in the pipeline to fill out read/write variables. The value can be one of surface, atmosphere, or displacement. You can specify the pipeline option multiple times. Each use of the option affects any variables specified after it (up to the next usage of pipeline if any).

gather(p, d, "pipeline", "surface", "Cf", surfCf,
             "pipeline", "atmosphere" "Cf", fogCf, "P", hitP)
See also
rays
shading

VEX Functions

Arrays

  • append

    Adds an item to an array or string.

  • argsort

    Returns the indices of a sorted version of an array.

  • array

    Efficiently creates an array from its arguments.

  • findlowerbound

    Finds the largest item smaller than a target value in an array.

  • findlowerboundsorted

    Finds the largest item smaller than a target value in a sorted array.

  • findsorted

    Finds an item in a sorted array.

  • foreach

    Loops over the items in an array, with optional enumeration.

  • insert

    Inserts an item, array, or string into an array or string.

  • isvalidindex

    Checks if the index given is valid for the array or string given.

  • len

    Returns the length of an array.

  • pop

    Removes the last element of an array and returns it.

  • push

    Adds an item to an array.

  • removeindex

    Removes an item at the given index from an array.

  • removevalue

    Removes an item from an array.

  • reorder

    Reorders items in an array or string.

  • resize

    Sets the length of an array.

  • reverse

    Returns an array or string in reverse order.

  • slice

    Slices a sub-string or sub-array of a string or array.

  • sort

    Returns the array sorted in increasing order.

  • upush

    Adds a uniform item to an array.

Attributes and Intrinsics

  • addattrib

    Adds an attribute to a geometry.

  • adddetailattrib

    Adds a detail attribute to a geometry.

  • addpointattrib

    Adds a point attribute to a geometry.

  • addprimattrib

    Adds a primitive attribute to a geometry.

  • addvertexattrib

    Adds a vertex attribute to a geometry.

  • addvisualizer

    Appends to a geometry’s visualizer detail attribute.

  • attrib

    Reads the value of an attribute from geometry.

  • attribclass

    Returns the class of a geometry attribute.

  • attribdataid

    Returns the data id of a geometry attribute.

  • attribsize

    Returns the size of a geometry attribute.

  • attribtype

    Returns the type of a geometry attribute.

  • attribtypeinfo

    Returns the transformation metadata of a geometry attribute.

  • curvearclen

    Evaluates the length of an arc on a primitive defined by an array of points using parametric uv coordinates.

  • detail

    Reads the value of a detail attribute value from a geometry.

  • detailattrib

    Reads a detail attribute value from a geometry.

  • detailattribsize

    Returns the size of a geometry detail attribute.

  • detailattribtype

    Returns the type of a geometry detail attribute.

  • detailattribtypeinfo

    Returns the type info of a geometry attribute.

  • detailintrinsic

    Reads the value of a detail intrinsic from a geometry.

  • findattribval

    Finds a primitive/point/vertex that has a certain attribute value.

  • findattribvalcount

    Returns number of elements where an integer or string attribute has a certain value.

  • getattrib

    Reads an attribute value from geometry, with validity check.

  • getattribute

    Copies the value of a geometry attribute into a variable and returns a success flag.

  • hasattrib

    Checks whether a geometry attribute exists.

  • hasdetailattrib

    Returns if a geometry detail attribute exists.

  • haspointattrib

    Returns if a geometry point attribute exists.

  • hasprimattrib

    Returns if a geometry prim attribute exists.

  • hasvertexattrib

    Returns if a geometry vertex attribute exists.

  • idtopoint

    Finds a point by its id attribute.

  • idtoprim

    Finds a primitive by its id attribute.

  • nametopoint

    Finds a point by its name attribute.

  • nametoprim

    Finds a primitive by its name attribute.

  • nuniqueval

    Returns the number of unique values from an integer or string attribute.

  • point

    Reads a point attribute value from a geometry.

  • pointattrib

    Reads a point attribute value from a geometry and outputs a success/fail flag.

  • pointattribsize

    Returns the size of a geometry point attribute.

  • pointattribtype

    Returns the type of a geometry point attribute.

  • pointattribtypeinfo

    Returns the type info of a geometry attribute.

  • pointlocaltransforms

    Returns an array of point localtransforms from an array of point indices.

  • pointtransform

    Returns a point transform from a point index.

  • pointtransformrigid

    Returns a rigid point transform from a point index.

  • pointtransforms

    Returns an array of point transforms from an array of point indices.

  • pointtransformsrigid

    Returns an array of rigid point transforms from an array of point indices.

  • prim

    Reads a primitive attribute value from a geometry.

  • prim_attribute

    Interpolates the value of an attribute at a certain parametric (u, v) position and copies it into a variable.

  • primarclen

    Evaluates the length of an arc on a primitive using parametric uv coordinates.

  • primattrib

    Reads a primitive attribute value from a geometry, outputting a success flag.

  • primattribsize

    Returns the size of a geometry prim attribute.

  • primattribtype

    Returns the type of a geometry prim attribute.

  • primattribtypeinfo

    Returns the type info of a geometry attribute.

  • primduv

    Returns position derivative on a primitive at a certain parametric (u, v) position.

  • priminteriorweights

    Finds the indices and weightings of the vertices that will compute an interior point given the UVW coordinates.

  • primintrinsic

    Reads a primitive intrinsic from a geometry.

  • primuv

    Interpolates the value of an attribute at a certain parametric (uvw) position.

  • primuvconvert

    Convert parametric UV locations on curve primitives between different spaces.

  • removedetailattrib

    Removes a detail attribute from a geometry.

  • removepointattrib

    Removes a point attribute from a geometry.

  • removepointgroup

    Removes a point group from a geometry.

  • removeprimattrib

    Removes a primitive attribute from a geometry.

  • removeprimgroup

    Removes a primitive group from a geometry.

  • removevertexattrib

    Removes a vertex attribute from a geometry.

  • removevertexgroup

    Removes a vertex group from a geometry.

  • setattrib

    Writes an attribute value to geometry.

  • setattribtypeinfo

    Sets the meaning of an attribute in geometry.

  • setdetailattrib

    Sets a detail attribute in a geometry.

  • setdetailintrinsic

    Sets the value of a writeable detail intrinsic attribute.

  • setpointattrib

    Sets a point attribute in a geometry.

  • setpointlocaltransforms

    Sets an array of point local transforms at the given point indices.

  • setpointtransform

    Sets the world space transform of a given point

  • setpointtransforms

    Sets an array of point transforms at the given point indices.

  • setprimattrib

    Sets a primitive attribute in a geometry.

  • setprimintrinsic

    Sets the value of a writeable primitive intrinsic attribute.

  • setvertexattrib

    Sets a vertex attribute in a geometry.

  • uniqueval

    Returns one of the set of unique values across all values for an int or string attribute.

  • uniquevals

    Returns the set of unique values across all values for an int or string attribute.

  • uvsample

    Interpolates the value of an attribute at certain UV coordinates using a UV attribute.

  • vertex

    Reads a vertex attribute value from a geometry.

  • vertexattrib

    Reads a vertex attribute value from a geometry.

  • vertexattribsize

    Returns the size of a geometry vertex attribute.

  • vertexattribtype

    Returns the type of a geometry vertex attribute.

  • vertexattribtypeinfo

    Returns the type info of a geometry attribute.

BSDFs

  • albedo

    Returns the albedo (percentage of reflected light) for a bsdf given the outgoing light direction.

  • ashikhmin

    Returns a specular BSDF using the Ashikhmin shading model.

  • blinn

    Returns a Blinn BSDF or computes Blinn shading.

  • chiang

    Returns a chiang BSDF.

  • chiang_fur

    Returns a chiang_fur BSDF.

  • cone

    Returns a cone reflection BSDF.

  • cvex_bsdf

    Creates a bsdf object from two CVEX shader strings.

  • diffuse

    Returns a diffuse BSDF or computes diffuse shading.

  • eval_bsdf

    Evaluates a bsdf given two vectors.

  • getbounces

  • ggx

    Returns a ggx BSDF.

  • hair

    Returns a BSDF for shading hair.

  • henyeygreenstein

    Returns an anisotropic volumetric BSDF, which can scatter light forward or backward.

  • isotropic

    Returns an isotropic BSDF, which scatters light equally in all directions.

  • mask_bsdf

    Returns new BSDF that only includes the components specified by the mask.

  • normal_bsdf

    Returns the normal for the diffuse component of a BSDF.

  • phong

    Returns a Phong BSDF or computes Phong shading.

  • phonglobe

  • sample_bsdf

    Samples a BSDF.

  • solid_angle

    Computes the solid angle (in steradians) a BSDF function subtends.

  • split_bsdf

    Splits a bsdf into its component lobes.

  • sssapprox

    Creates an approximate SSS BSDF.

BSDFs

  • specular

    Returns a specular BSDF or computes specular shading.

CHOP

  • chadd

    Adds new channels to a CHOP node.

  • chattr

    Reads from a CHOP attribute.

  • chattrnames

    Reads CHOP attribute names of a given attribute class from a CHOP input.

  • chend

    Returns the sample number of the last sample in a given CHOP input.

  • chendf

    Returns the frame corresponding to the last sample of the input specified.

  • chendt

    Returns the time corresponding to the last sample of the input specified.

  • chindex

    Returns the channel index from a input given a channel name.

  • chinput

    Returns the value of a channel at the specified sample.

  • chinputlimits

    Computes the minimum and maximum value of samples in an input channel.

  • chnames

    Returns all the CHOP channel names of a given CHOP input.

  • chnumchan

    Returns the number of channels in the input specified.

  • chop

    Returns the value of a CHOP channel at the specified sample.

  • choplocal

    Returns the value of a CHOP local transform channel at the specified sample.

  • choplocalt

    Returns the value of a CHOP local transform channel at the specified sample and evaluation time.

  • chopt

    Returns the value of a CHOP channel at the specified sample and evaluation time.

  • chrate

    Returns the sample rate of the input specified.

  • chreadbuf

    Returns the value of CHOP context temporary buffer at the specified index.

  • chremove

    Removes channels from a CHOP node.

  • chremoveattr

    Removes a CHOP attribute.

  • chrename

    Renames a CHOP channel.

  • chresizebuf

    Resize the CHOP context temporary buffer

  • chsetattr

    Sets the value of a CHOP attribute.

  • chsetlength

    Sets the length of the CHOP channel data.

  • chsetrate

    Sets the sampling rate of the CHOP channel data.

  • chsetstart

    Sets the CHOP start sample in the channel data.

  • chstart

    Returns the start sample of the input specified.

  • chstartf

    Returns the frame corresponding to the first sample of the input specified.

  • chstartt

    Returns the time corresponding to the first sample of the input specified.

  • chwritebuf

    Writes a value of CHOP context temporary buffer at the specified index.

  • isframes

    Returns 1 if the Vex CHOP’s Unit Menu is currently set to 'frames', 0 otherwise.

  • issamples

    Returns 1 if the Vex CHOP’s Unit Menu is currently set to 'samples', 0 otherwise.

  • isseconds

    Returns 1 if the Vex CHOP’s Unit Menu is currently set to 'seconds', 0 otherwise.

  • ninputs

    Returns the number of inputs.

Channel Primitives

color

  • blackbody

    Compute the color value of an incandescent black body.

  • ctransform

    Transforms between color spaces.

  • luminance

    Compute the luminance of the RGB color specified by the parameters.

Conversion

  • atof

    Converts a string to a float.

  • atoi

    Converts a string to an integer.

  • cracktransform

    Depending on the value of c, returns the translate (c=0), rotate (c=1), scale (c=2), or shears (c=3) component of the transform (xform).

  • degrees

    Converts the argument from radians into degrees.

  • eulertoquaternion

    Creates a vector4 representing a quaternion from euler angles.

  • hsvtorgb

    Convert HSV color space into RGB color space.

  • qconvert

    Converts a quaternion represented by a vector4 to a matrix3 representation.

  • quaterniontoeuler

    Creates a euler angle representing a quaternion.

  • radians

    Converts the argument from degrees into radians.

  • rgbtohsv

    Convert RGB color space to HSV color space.

  • rgbtoxyz

    Convert a linear sRGB triplet to CIE XYZ tristimulus values.

  • serialize

    Flattens an array of vector or matrix types into an array of floats.

  • unserialize

    Turns a flat array of floats into an array of vectors or matrices.

  • xyztorgb

    Convert CIE XYZ tristimulus values to a linear sRGB triplet.

Crowds

dict

  • json_dumps

    Converts a VEX dictionary into a JSON string.

  • json_loads

    Converts a JSON string into a VEX dictionary.

  • keys

    Returns all the keys in a dictionary.

  • typeid

    Returns a numeric code identifying a VEX data type.

displace

  • dimport

    Reads a variable from the displacement shader for the surface.

File I/O

  • file_stat

    Returns file system status for a given file.

filter

  • filter_remap

    Computes an importance sample based on the given filter type and input uv.

Fuzzy Logic

Geometry

  • addpoint

    Adds a point to the geometry.

  • addprim

    Adds a primitive to the geometry.

  • addvertex

    Adds a vertex to a primitive in a geometry.

  • clip

    Clip the line segment between p0 and p1.

  • geoself

    Returns a handle to the current geometry.

  • geounwrap

    Returns an oppath: string to unwrap the geometry in-place.

  • inedgegroup

    Returns 1 if the edge specified by the point pair is in the group specified by the string.

  • intersect

    This function computes the first intersection of a ray with geometry.

  • intersect_all

    Computes all intersections of the specified ray with geometry.

  • minpos

    Given a position in world space, returns the position of the closest point on a given geometry.

  • nearpoint

    Finds the closest point in a geometry.

  • nearpoints

    Finds the all the closest point in a geometry.

  • nedgesgroup

    Returns the number of edges in the group.

  • neighbour

    Returns the point number of the next point connected to a given point.

  • neighbourcount

    Returns the number of points that are connected to the specified point.

  • neighbours

    Returns an array of the point numbers of the neighbours of a point.

  • npoints

    Returns the number of points in the input or geometry file.

  • nprimitives

    Returns the number of primitives in the input or geometry file.

  • nvertices

    Returns the number of vertices in the input or geometry file.

  • nverticesgroup

    Returns the number of vertices in the group.

  • pointprims

    Returns the list of primitives containing a point.

  • pointvertex

    Returns a linear vertex number of a point in a geometry.

  • pointvertices

    Returns the list of vertices connected to a point.

  • polyneighbours

    Returns an array of the primitive numbers of the edge-neighbours of a polygon.

  • primfind

    Returns a list of primitives potentially intersecting a given bounding box.

  • primpoint

    Converts a primitive/vertex pair into a point number.

  • primpoints

    Returns the list of points on a primitive.

  • primvertex

    Converts a primitive/vertex pair into a linear vertex.

  • primvertexcount

    Returns number of vertices in a primitive in a geometry.

  • primvertices

    Returns the list of vertices on a primitive.

  • removeattrib

    Removes an attribute or group from the geometry.

  • removepoint

    Removes a point from the geometry.

  • removeprim

    Removes a primitive from the geometry.

  • removevertex

    Removes a vertex from the geometry.

  • setedgegroup

    Sets edge group membership in a geometry.

  • setprimvertex

    Rewires a vertex in the geometry to a different point.

  • setvertexpoint

    Rewires a vertex in the geometry to a different point.

  • uvintersect

    This function computes the intersection of the specified ray with the geometry in uv space.

  • vertexcurveparam

    Returns the parametric coordinate of a vertex along the perimeter of its primitive.

  • vertexindex

    Converts a primitive/vertex pair into a linear vertex.

  • vertexnext

    Returns the linear vertex number of the next vertex sharing a point with a given vertex.

  • vertexpoint

    Returns the point number of linear vertex in a geometry.

  • vertexprev

    Returns the linear vertex number of the previous vertex sharing a point with a given vertex.

  • vertexprim

    Returns the number of the primitive containing a given vertex.

  • vertexprimindex

    Converts a linear vertex index into a primitive vertex number.

groups

  • expandedgegroup

  • expandpointgroup

    Returns an array of point numbers corresponding to a group string.

  • expandprimgroup

    Returns an array of prim numbers corresponding to a group string.

  • expandvertexgroup

    Returns an array of linear vertex numbers corresponding to a group string.

  • inpointgroup

    Returns 1 if the point specified by the point number is in the group specified by the string.

  • inprimgroup

    Returns 1 if the primitive specified by the primitive number is in the group specified by the string.

  • invertexgroup

    Returns 1 if the vertex specified by the vertex number is in the group specified by the string.

  • npointsgroup

    Returns the number of points in the group.

  • nprimitivesgroup

    Returns the number of primitives in the group.

  • setpointgroup

    Adds or removes a point to/from a group in a geometry.

  • setprimgroup

    Adds or removes a primitive to/from a group in a geometry.

  • setvertexgroup

    Adds or removes a vertex to/from a group in a geometry.

Half-edges

  • hedge_dstpoint

    Returns the destination point of a half-edge.

  • hedge_dstvertex

    Returns the destination vertex of a half-edge.

  • hedge_equivcount

    Returns the number of half-edges equivalent to a given half-edge.

  • hedge_isequiv

    Determines whether a two half-edges are equivalent (represent the same edge).

  • hedge_isprimary

    Determines whether a half-edge number corresponds to a primary half-edge.

  • hedge_isvalid

    Determines whether a half-edge number corresponds to a valid half-edge.

  • hedge_next

    Returns the half-edge that follows a given half-edge in its polygon.

  • hedge_nextequiv

    Returns the next half-edges equivalent to a given half-edge.

  • hedge_postdstpoint

    Returns the point into which the vertex following the destination vertex of a half-edge in its primitive is wired.

  • hedge_postdstvertex

    Returns the vertex following the destination vertex of a half-edge in its primitive.

  • hedge_presrcpoint

    Returns the point into which the vertex that precedes the source vertex of a half-edge in its primitive is wired.

  • hedge_presrcvertex

    Returns the vertex that precedes the source vertex of a half-edge in its primitive.

  • hedge_prev

    Returns the half-edge that precedes a given half-edge in its polygon.

  • hedge_prim

    Returns the primitive that contains a half-edge.

  • hedge_primary

    Returns the primary half-edge equivalent to a given half-edge.

  • hedge_srcpoint

    Returns the source point of a half-edge.

  • hedge_srcvertex

    Returns the source vertex of a half-edge.

  • pointedge

    Finds and returns a half-edge with the given endpoints.

  • pointhedge

    Finds and returns a half-edge with a given source point or with given source and destination points.

  • pointhedgenext

    Returns the next half-edge with the same source as a given half-edge.

  • primhedge

    Returns one of the half-edges contained in a primitive.

  • vertexhedge

    Returns the half-edge which has a vertex as source.

hex

  • hex_adjacent

    Returns primitive number of an adjacent hexahedron.

  • hex_faceindex

    Returns vertex indices of each face of a hexahedron.

Image Processing

  • accessframe

    Tells the COP manager that you need access to the given frame.

  • alphaname

    Returns the default name of the alpha plane (as it appears in the compositor preferences).

  • binput

    Samples a 2×2 pixel block around the given UV position, and bilinearly interpolates these pixels.

  • bumpname

    Returns the default name of the bump plane (as it appears in the compositor preferences).

  • chname

    Returns the name of a numbered channel.

  • cinput

    Samples the exact (unfiltered) pixel color at the given coordinates.

  • colorname

    Returns the default name of the color plane (as it appears in the compositor preferences).

  • depthname

    Returns the default name of the depth plane (as it appears in the compositor preferences).

  • dsmpixel

    Reads the z-records stored in a pixel of a deep shadow map or deep camera map.

  • finput

    Returns fully filtered pixel input.

  • hasmetadata

    Queries if metadata exists on a composite operator.

  • hasplane

    Returns 1 if the plane specified by the parameter exists in this COP.

  • iaspect

    Returns the aspect ratio of the specified input.

  • ichname

    Returns the channel name of the indexed plane of the given input.

  • iend

    Returns the last frame of the specified input.

  • iendtime

    Returns the end time of the specified input.

  • ihasplane

    Returns 1 if the specified input has a plane named planename.

  • inumplanes

    Returns the number of planes in the given input.

  • iplaneindex

    Returns the index of the plane named 'planename' in the specified input.

  • iplanename

    Returns the name of the plane specified by the planeindex of the given input

  • iplanesize

    Returns the number of components in the plane named planename in the specified input.

  • irate

    Returns the frame rate of the specified input.

  • istart

    Returns the starting frame of the specified input.

  • istarttime

    Returns the start time of the specified input.

  • ixres

    Returns the X resolution of the specified input.

  • iyres

    Returns the Y resolution of the specified input.

  • lumname

    Returns the default name of the luminaence plane (as it appears in the compositor preferences).

  • maskname

    Returns the default name of the mask plane (as it appears in the compositor preferences).

  • metadata

    Returns a metadata value from a composite operator.

  • ninput

    Reads a component from a pixel and its eight neighbors.

  • normalname

    Returns the default name of the normal plane (as it appears in the compositor preferences).

  • planeindex

    Returns the index of the plane specified by the parameter, starting at zero.

  • planename

    Returns the name of the plane specified by the index (e.

  • planesize

    Returns the number of components in the plane (1 for scalar planes and up to 4 for vector planes).

  • pointname

    Returns the default name of the point plane (as it appears in the compositor preferences).

  • velocityname

    Returns the default name of the velocity plane (as it appears in the compositor preferences).

Interpolation

  • ckspline

    Samples a Catmull-Rom (Cardinal) spline defined by position/value keys.

  • clamp

    Returns value clamped between min and max.

  • cspline

    Samples a Catmull-Rom (Cardinal) spline defined by uniformly spaced keys.

  • efit

    Takes the value in one range and shifts it to the corresponding value in a new range.

  • fit

    Takes the value in one range and shifts it to the corresponding value in a new range.

  • fit01

    Takes the value in the range (0, 1) and shifts it to the corresponding value in a new range.

  • fit10

    Takes the value in the range (1, 0) and shifts it to the corresponding value in a new range.

  • fit11

    Takes the value in the range (-1, 1) and shifts it to the corresponding value in a new range.

  • invlerp

    Inverses a linear interpolation between the values.

  • lerp

    Performs linear interpolation between the values.

  • lkspline

    Samples a polyline between the key points.

  • lspline

    Samples a polyline defined by linearly spaced values.

  • slerp

    Quaternion blend between q1 and q2 based on the bias.

  • slerpv

    Spherical blends between two vectors based on the bias.

  • smooth

    Computes ease in/out interpolation between values.

light

  • ambient

    Returns the color of ambient light in the scene.

  • atten

    Computes attenuated falloff.

  • fastshadow

    Sends a ray from the position P along the direction specified by the direction D.

  • filtershadow

    Sends a ray from the position P along direction D.

Math

  • abs

    Returns the absolute value of the argument.

  • acos

    Returns the inverse cosine of the argument.

  • asin

    Returns the inverse sine of the argument.

  • atan

    Returns the inverse tangent of the argument.

  • atan2

    Returns the inverse tangent of y/x.

  • avg

    Returns the average value of the input(s)

  • cbrt

    Returns the cube root of the argument.

  • ceil

    Returns the smallest integer greater than or equal to the argument.

  • combinelocaltransform

    Combines Local and Parent Transforms with Scale Inheritance.

  • cos

    Returns the cosine of the argument.

  • cosh

    Returns the hyperbolic cosine of the argument.

  • cospi

    Returns the cosine of the argument scaled by Pi.

  • cross

    Returns the cross product between the two vectors.

  • determinant

    Computes the determinant of the matrix.

  • diag

    Extracts diagonal entries or constructs a diagonal matrix.

  • diagonalizesymmetric

    Diagonalizes Symmetric Matrices.

  • distance_pointline

    This function returns the closest distance between the point Q and the infinite line going through O parallel to vector D.

  • distance_pointray

    This function returns the closest distance between the point Q and the semi-finite ray starting at O and extending in the direction D.

  • distance_pointsegment

    This function returns the closest distance between the point Q and a finite line segment between points P0 and P1.

  • dot

    Returns the dot product between the arguments.

  • Du

    Returns the derivative of the given value with respect to U.

  • Dv

    Returns the derivative of the given value with respect to V.

  • Dw

    Returns the derivative of the given value with respect to the 3rd axis (for volume rendering).

  • eigenvalues

    Computes the eigenvalues of a 3×3 matrix.

  • erf

    Gauss error function.

  • erf_inv

    Inverse Gauss error function.

  • erfc

    Gauss error function’s complement.

  • exp

    Returns the exponential function of the argument.

  • extractlocaltransform

    Extracts Local Transform from a World Transform with Scale Inheritance.

  • floor

    Returns the largest integer less than or equal to the argument.

  • frac

    Returns the fractional component of the floating point number.

  • ident

    Returns an identity matrix.

  • invert

    Inverts a matrix.

  • isfinite

    Checks whether a value is a normal finite number.

  • isinf

    Checks whether a value is a positive or negative infinity.

  • isnan

    Checks whether a value is not a number.

  • kspline

    Returns an interpolated value along a curve defined by a basis and key/position pairs.

  • length

    Returns the magnitude of a vector.

  • length2

    Returns the squared distance of the vector or vector4.

  • log

    Returns the natural logarithm of the argument.

  • log10

    Returns the logarithm (base 10) of the argument.

  • makebasis

    Creates an orthonormal basis given a z-axis vector.

  • max

  • min

  • norm_1

    Returns the induced matrix 1-norm.

  • norm_fro

    Returns the Frobenius norm of a matrix.

  • norm_inf

    Returns the induced matrix infinity-norm.

  • norm_max

    Returns the matrix max-norm.

  • norm_spectral

    Returns the matrix spectral norm.

  • normalize

    Returns a normalized vector.

  • outerproduct

    Returns the outer product between the arguments.

  • pinvert

    Computes the pseudo-inverse of a matrix.

  • planesphereintersect

    Computes the intersection of a 3D sphere and an infinite 3D plane.

  • pow

    Raises the first argument to the power of the second argument.

  • predicate_incircle

    Determines if a point is inside or outside a triangle circumcircle.

  • predicate_insphere

    Determines if a point is inside or outside a tetrahedron circumsphere.

  • predicate_orient2d

    Determines the orientation of a point with respect to a line.

  • predicate_orient3d

    Determines the orientation of a point with respect to a plane.

  • premul

    Pre multiply matrices.

  • product

    Returns the product of a list of numbers.

  • ptlined

    This function returns the closest distance between the point Q and a finite line segment between points P0 and P1.

  • qdistance

    Finds distance between two quaternions.

  • qinvert

    Inverts a quaternion rotation.

  • qmultiply

    Multiplies two quaternions and returns the result.

  • qrotate

    Rotates a vector by a quaternion.

  • quaternion

    Creates a vector4 representing a quaternion.

  • resample_linear

  • rint

    Rounds the number to the closest whole number.

  • shl

    Bit-shifts an integer left.

  • shr

    Bit-shifts an integer right.

  • shrz

    Bit-shifts an integer right.

  • sign

    Returns -1, 0, or 1 depending on the sign of the argument.

  • sin

    Returns the sine of the argument.

  • sinh

    Returns the hyperbolic sine of the argument.

  • sinpi

    Returns the sine of the argument scaled by Pi.

  • slideframe

    Finds the normal component of frame slid along a curve.

  • solvecubic

    Solves a cubic function returning the number of real roots.

  • solvepoly

    Finds the real roots of a polynomial.

  • solvequadratic

    Solves a quadratic function returning the number of real roots.

  • solvetriangleSSS

    Finds the angles of a triangle from its sides.

  • spline

    Samples a value along a polyline or spline curve.

  • spline_cdf

    Generate a cumulative distribution function (CDF) by sampling a spline curve.

  • sqrt

    Returns the square root of the argument.

  • sum

    Returns the sum of a list of numbers.

  • svddecomp

    Computes the singular value decomposition of a given matrix.

  • tan

    Returns the trigonometric tangent of the argument

  • tanh

    Returns the hyperbolic tangent of the argument

  • tanpi

    Returns the trigonometric tangent of the argument scaled by Pi

  • tr

    Returns the trace of the given matrix.

  • transpose

    Transposes the given matrix.

  • trunc

    Removes the fractional part of a floating point number.

measure

  • distance

    Returns the distance between two points.

  • distance2

    Returns the squared distance between the two points.

  • getbbox

    Sets two vectors to the minimum and maximum corners of the bounding box for the geometry.

  • getbbox_center

    Returns the center of the bounding box for the geometry.

  • getbbox_max

    Returns the maximum of the bounding box for the geometry.

  • getbbox_min

    Returns the minimum of the bounding box for the geometry.

  • getbbox_size

    Returns the size of the bounding box for the geometry.

  • getbounds

    Returns the bounding box of the geometry specified by the filename.

  • getpointbbox

    Sets two vectors to the minimum and maximum corners of the bounding box for the geometry.

  • getpointbbox_center

    Returns the center of the bounding box for the geometry.

  • getpointbbox_max

    Returns the maximum of the bounding box for the geometry.

  • getpointbbox_min

    Returns the minimum of the bounding box for the geometry.

  • getpointbbox_size

    Returns the size of the bounding box for the geometry.

  • planepointdistance

    Computes the distance and closest point of a point to an infinite plane.

  • relbbox

    Returns the relative position of the point given with respect to the bounding box of the geometry.

  • relpointbbox

    Returns the relative position of the point given with respect to the bounding box of the geometry.

  • surfacedist

    Finds the distance of a point to a group of points along the surface of a geometry.

  • uvdist

    Finds the distance of a uv coordinate to a geometry in uv space.

  • windingnumber

    Computes the winding number of a mesh around a point. Winding number indicates how many times a geometry wraps around a point. Useful for inside/outside test, the winding number is equal to one inside of the mesh and zero outside.

  • windingnumber2d

    Computes the winding number of a curve in XY plane around a point. Winding number indicates how many times a curve wraps around a point. Useful for inside/outside test, the winding number is equal to one inside of the curve and zero outside.

  • xyzdist

    Finds the distance from a point to the closest location on surface geometry.

metaball

  • metaimport

    Once you get a handle to a metaball using metastart and metanext, you can query attributes of the metaball with metaimport.

  • metamarch

    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.

  • metanext

    Iterate to the next metaball in the list of metaballs returned by the metastart() function.

  • metastart

    Open a geometry file and return a handle for the metaballs of interest, at the position p.

  • metaweight

    Returns the metaweight of the geometry at position p.

Nodes

  • addvariablename

    Adds a mapping for an attribute to a local variable.

  • ch

    Evaluates a channel (or parameter) and return its value.

  • ch2

    Evaluates a channel (or parameter) and return its value.

  • ch3

    Evaluates a channel (or parameter) and return its value.

  • ch4

    Evaluates a channel (or parameter) and return its value.

  • chdict

    Evaluates a key-value dictionary parameter and return its value.

  • chexpr

    Evaluates a channel with a new segment expression.

  • chexprf

    Evaluates a channel with a new segment expression at a given frame.

  • chexprt

    Evaluates a channel with a new segment expression at a given time.

  • chf

    Evaluates a channel (or parameter) and return its value.

  • chi

    Evaluates a channel (or parameter) and return its value.

  • chid

    Resolves a channel string (or parameter) and return op_id, parm_index and vector_index.

  • chp

    Evaluates a channel (or parameter) and return its value.

  • chramp

    Evaluates a ramp parameter and return its value.

  • chrampderiv

    Evaluates the derivative of a parm parameter with respect to position.

  • chs

    Evaluates a channel (or parameter) and return its value.

  • chsop

    Evaluates an operator path parameter and return the path to the operator.

  • chsraw

    Returns the raw string channel (or parameter).

  • chu

    Evaluates a channel or parameter, and return its value.

  • chv

    Evaluates a channel or parameter, and return its value.

  • cregioncapturetransform

    Returns the capture transform associated with a Capture Region SOP.

  • cregiondeformtransform

    Returns the deform transform associated with a Capture Region SOP.

  • cregionoverridetransform

    Returns the capture or deform transform associated with a Capture Region SOP based on the global capture override flag.

  • isconnected

    Returns 1 if input_number is connected, or 0 if the input is not connected.

  • opfullpath

    Returns the full path for the given relative path

  • opid

    Resolves an operator path string and return its op_id.

  • opparentbonetransform

    Returns the parent bone transform associated with an OP.

  • opparenttransform

    Returns the parent transform associated with an OP.

  • opparmtransform

    Returns the parm transform associated with an OP.

  • oppreconstrainttransform

    Returns the preconstraint transform associated with an OP.

  • oppreparmtransform

    Returns the pre and parm transform associated with an OP.

  • opprerawparmtransform

    Returns the pre and raw parm transform associated with an OP.

  • oppretransform

    Returns the pretransform associated with an OP.

  • oprawparmtransform

    Returns the raw parm transform associated with an OP.

  • optransform

    Returns the transform associated with an OP.

Noise and Randomness

  • anoise

    Generates alligator noise.

  • curlgxnoise

    Computes divergence free noise based on simplex noise.

  • curlgxnoise2d

    Computes divergence free noise in the plane based on simplex noise.

  • curlnoise

    Computes divergence free noise based on Perlin noise.

  • curlnoise2d

    Computes 2d divergence free noise based on Perlin noise.

  • curlxnoise

    Computes divergence free noise based on Simplex noise.

  • curlxnoise2d

    Computes 2d divergence free noise based on simplex noise.

  • cwnoise

    Generates Worley (cellular) noise using a Chebyshev distance metric.

  • flownoise

    Generates 1D and 3D Perlin Flow Noise from 3D and 4D data.

  • flowpnoise

    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.

  • gxnoise

    Evaluates a simplex noise field.

  • gxnoised

    Evaluates a simplex noise field and its derivatives.

  • hscript_noise

    Generates noise matching the output of the Hscript noise() expression function.

  • hscript_rand

    Produces the exact same results as the Houdini expression function of the same name.

  • hscript_snoise

  • hscript_sturb

  • hscript_turb

    Generates turbulence matching the output of the HScript turb() expression function.

  • mwnoise

    Generates Worley (cellular) noise using a Manhattan distance metric.

  • mx_cellnoise

    MaterialX compatible cellnoise

  • mx_perlin

    MaterialX compatible Perlin noise

  • mx_voronoi

    MaterialX compatible Voronoi noise

  • mx_worley

    MaterialX compatible Worley noise

  • noise

    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.

  • noised

    Derivatives of Perlin Noise.

  • nrandom

    Non-deterministic random number generation function.

  • onoise

    These functions are similar to wnoise and vnoise.

  • pnoise

    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.

  • pxnoised

    Periodic derivatives of Simplex Noise.

  • rand

    Creates a random number between 0 and 1 from a seed.

  • random

    Generate a random number based on the integer position in 1-4D space.

  • random_brj

    Generate a uniformly distributed random number.

  • random_fhash

    Hashes floating point numbers to integers.

  • random_ihash

    Hashes integer numbers to integers.

  • random_poisson

    Generates a random Poisson variable given the mean to the distribution and a seed.

  • random_shash

    Hashes a string to an integer.

  • random_sobol

    Generate a uniformly distributed random number.

  • snoise

    These functions are similar to wnoise.

  • vnoise

    Generates Voronoi (cellular) noise.

  • wnoise

    Generates Worley (cellular) noise.

  • xnoise

    Simplex noise is very close to Perlin noise, except with the samples on a simplex mesh rather than a grid. This results in less grid artifacts. It also uses a higher order bspline to provide better derivatives. This is the periodic simplex noise

  • xnoise

    Simplex noise is very close to Perlin noise, except with the samples on a simplex mesh rather than a grid. This results in less grid artifacts. It also uses a higher order bspline to provide better derivatives.

  • xnoised

    Derivatives of Simplex Noise.

normals

  • computenormal

    In shading contexts, computes a normal. In the SOP contexts, sets how/whether to recompute normals.

  • prim_normal

    Returns the normal of the primitive (prim_number) at parametric location u, v.

Open Color IO

particles

  • filamentsample

    Samples the velocity field defined by a set of vortex filaments.

Point Clouds and 3D Images

  • mattrib

    Returns the value of the point attribute for the metaballs if metaball geometry is specified to i3dgen.

  • mdensity

    Returns the density of the metaball field if metaball geometry is specified to i3dgen.

  • mspace

    Transforms the position specified into the local space of the metaball.

  • pcclose

    This function closes the handle associated with a pcopen function.

  • pccone

    Returns a list of closest points from a file within a specified cone.

  • pccone_radius

    Returns a list of closest points from a file in a cone, taking into account their radii

  • pcconvex

  • pcexport

    Writes data to a point cloud inside a pciterate or a pcunshaded loop.

  • pcfarthest

    Returns the distance to the farthest point found in the search performed by pcopen.

  • pcfilter

    Filters points found by pcopen using a simple reconstruction filter.

  • pcfind

    Returns a list of closest points from a file.

  • pcfind_radius

    Returns a list of closest points from a file taking into account their radii.

  • pcgenerate

    Generates a point cloud.

  • pcimport

    Imports channel data from a point cloud inside a pciterate or a pcunshaded loop.

  • pcimportbyidx3

    Imports channel data from a point cloud outside a pciterate or a pcunshaded loop.

  • pcimportbyidx4

    Imports channel data from a point cloud outside a pciterate or a pcunshaded loop.

  • pcimportbyidxf

    Imports channel data from a point cloud outside a pciterate or a pcunshaded loop.

  • pcimportbyidxi

    Imports channel data from a point cloud outside a pciterate or a pcunshaded loop.

  • pcimportbyidxp

    Imports channel data from a point cloud outside a pciterate or a pcunshaded loop.

  • pcimportbyidxs

    Imports channel data from a point cloud outside a pciterate or a pcunshaded loop.

  • pcimportbyidxv

    Imports channel data from a point cloud outside a pciterate or a pcunshaded loop.

  • pciterate

    This function can be used to iterate over all the points which were found in the pcopen query.

  • pcline

    Returns a list of closest points to an infinite line from a specified file

  • pcline_radius

    Returns a list of closest points to an infinite line from a specified file

  • pcnumfound

    This node returns the number of points found by pcopen.

  • pcopen

    Returns a handle to a point cloud file.

  • pcopenlod

    Returns a handle to a point cloud file.

  • pcsampleleaf

    Changes the current iteration point to a leaf descendant of the current aggregate point.

  • pcsegment

    Returns a list of closest points to a line segment from a specified file

  • pcsegment_radius

    Returns a list of closest points to a line segment from a specified file

  • pcsize

  • pcunshaded

    Iterate over all of the points of a read-write channel which haven’t had any data written to the channel yet.

  • pcwrite

    Writes data to a point cloud file.

  • pgfind

    Returns a list of closest points from a file.

  • photonmap

    Samples a color from a photon map.

  • texture3d

    Returns the value of the 3d image at the position specified by P.

  • texture3dBox

    This function queries the 3D texture map specified and returns the bounding box information of the file.

Sampling

  • create_cdf

    Creates a cumulative distribution function (CDF) from an array of probability density function (PDF) values.

  • create_pdf

    Creates a probability density function from an array of input values.

  • limit_sample_space

    Limits a unit value in a way that maintains uniformity and in-range consistency.

  • newsampler

    Initializes a sampling sequence for the nextsample function.

  • nextsample

  • sample_cauchy

    Samples the Cauchy (Lorentz) distribution.

  • sample_cdf

    Samples a cumulative distribution function (CDF).

  • sample_circle_arc

    Generates a uniform unit vector2, within maxangle of center, given a uniform number between 0 and 1.

  • sample_circle_edge_uniform

    Generates a uniform unit vector2, given a uniform number between 0 and 1.

  • sample_circle_ring_uniform

    Generates a uniform vector2 with alpha < length < 1, where 0 < alpha < 1, given a vector2 of uniform numbers between 0 and 1.

  • sample_circle_slice

    Generates a uniform vector2 with length < 1, within maxangle of center, given a vector2 of uniform numbers between 0 and 1.

  • sample_circle_uniform

    Generates a uniform vector2 with length < 1, given a vector2 of uniform numbers between 0 and 1.

  • sample_direction_cone

    Generates a uniform unit vector, within maxangle of center, given a vector2 of uniform numbers between 0 and 1.

  • sample_direction_uniform

    Generates a uniform unit vector, given a vector2 of uniform numbers between 0 and 1.

  • sample_discrete

    Returns an integer, either uniform or weighted, given a uniform number between 0 and 1.

  • sample_exponential

    Samples the exponential distribution.

  • sample_geometry

    Samples geometry in the scene and returns information from the shaders of surfaces that were sampled.

  • sample_hemisphere

    Generates a unit vector, optionally biased, within a hemisphere, given a vector2 of uniform numbers between 0 and 1.

  • sample_hypersphere_cone

    Generates a uniform vector4 with length < 1, within maxangle of center, given a vector4 of uniform numbers between 0 and 1.

  • sample_hypersphere_uniform

    Generates a uniform vector4 with length < 1, given a vector4 of uniform numbers between 0 and 1.

  • sample_light

    Samples a 3D position on a light source and runs the light shader at that point.

  • sample_lognormal

    Samples the log-normal distribution based on parameters of the underlying normal distribution.

  • sample_lognormal_by_median

    Samples the log-normal distribution based on median and standard deviation.

  • sample_normal

    Samples the normal (Gaussian) distribution.

  • sample_orientation_cone

    Generates a uniform unit vector4, within maxangle of center, given a vector of uniform numbers between 0 and 1.

  • sample_orientation_uniform

    Generates a uniform unit vector4, given a vector of uniform numbers between 0 and 1.

  • sample_photon

    Samples a 3D position on a light source and runs the light shader at that point.

  • sample_sphere_cone

    Generates a uniform vector with length < 1, within maxangle of center, given a vector of uniform numbers between 0 and 1.

  • sample_sphere_shell_uniform

    Generates a uniform vector with alpha < length < 1, where 0 < alpha < 1, given a vector of uniform numbers between 0 and 1.

  • sample_sphere_uniform

    Generates a uniform vector with length < 1, given a vector of uniform numbers between 0 and 1.

  • sampledisk

    Warps uniform random samples to a disk.

  • variance

    Computes the mean value and variance for a value.

Sensor Input

Shading and Rendering

  • area

    Returns the area of the micropolygon containing a variable such as P.

  • blinnBRDF

  • bouncelabel

  • bouncemask

  • diffuseBRDF

  • filterstep

    Returns the anti-aliased weight of the step function.

  • fresnel

    Computes the fresnel reflection/refraction contributions given an incoming vector, surface normal (both normalized), and an index of refraction (eta).

  • frontface

    If dot(I, Nref) is less than zero, N will be negated.

  • gather

    Sends rays into the scene and returns information from the shaders of surfaces hit by the rays.

  • getblurP

    Returns the blurred point position (P) vector at a fractional time within the motion blur exposure.

  • getcomponents

  • getderiv

    Evaluates surface derivatives of an attribute.

  • getfogname

    Returns the name of the current object whose shader is being run.

  • getglobalraylevel

    Returns the depth of the ray tree for computing global illumination.

  • getgroupid

    Returns group id containing current primitive.

  • getlight

    Returns a light struct for the specified light identifier.

  • getlightid

    Returns the light id for a named light (or -1 for an invalid name).

  • getlightname

    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.

  • getlights

    Returns an array of light identifiers for the currently shaded surface.

  • getlightscope

    Returns a selection of lights that illuminate a given material.

  • getlocalcurvature

    Evaluates local curvature of primitive grid, using the same curvature evaluation method as Measure SOPs.

  • getmaterial

    Returns a material struct for the current surface.

  • getmaterialid

    Returns material id of shaded primitive.

  • getobjectid

    Returns the object id for the current shading context.

  • getobjectname

    Returns the name of the current object whose shader is being run.

  • getphotonlight

    Returns the integer ID of the light being used for photon shading.

  • getprimid

    Returns the number of the current primitive.

  • getptextureid

    Returns the ptexture face id for the current primitive.

  • getraylevel

    Returns the depth of the ray tree for the current shading.

  • getrayweight

    Returns an approximation to the contribution of the ray to the final pixel color.

  • getsamplestore

    Looks up sample data in a channel, referenced by a point.

  • getscope

    Returns a selection of objects visible to rays for a given material.

  • getsmoothP

    Returns modified surface position based on a smoothing function.

  • getuvtangents

    Evaluates UV tangents at a point on an arbitrary object.

  • gradient

    Returns the gradient of a field.

  • haslight

    Returns whether a light illuminates the given material.

  • illuminance

    Loops through all light sources in the scene, calling the light shader for each light source to set the Cl and L global variables.

  • integratehoseksky

    Computes irradiance from the given Hosek Sky on a horizontal surface

  • interpolate

    Interpolates a value across the currently shaded micropolygon.

  • intersect_lights

    Finds the nearest intersection of a ray with any of a list of (area) lights and runs the light shader at the intersection point.

  • irradiance

    Computes irradiance (global illumination) at the point P with the normal N.

  • isfogray

    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.

  • islpeactive

    Returns 1 if Light Path Expressions are enabled. 0 Otherwise.

  • israytracing

    Indicates whether a shader is being executed for ray tracing.

  • isshadingRHS

    Detects the orientation of default shading space.

  • isshadowray

    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.

  • isuvrendering

    Indicates whether the shader is being evaluated while doing UV rendering (e.g. texture unwrapping)

  • lightbounces

    Returns the bounce mask for a light struct.

  • lightid

    Returns the light id for a light struct.

  • lightstate

    Queries the renderer for a named property.

  • limport

    Imports a variable from the light shader for the surface.

  • matchvex_blinn

    Returns a BSDF that matches the output of the traditional VEX blinn function.

  • matchvex_specular

    Returns a BSDF that matches the output of the traditional VEX specular function.

  • nbouncetypes

  • objectstate

    Queries the renderer for a named property.

  • occlusion

    Computes ambient occlusion.

  • pathtrace

    Computes global illumination using PBR for secondary bounces.

  • phongBRDF

  • rayhittest

    Sends a ray from the position P along the direction D.

  • rayimport

    Imports a value sent by a shader in a gather loop.

  • reflect

    Returns the vector representing the reflection of the direction against the normal.

  • reflectlight

    Computes the amount of reflected light which hits the surface.

  • refract

    Returns the refraction ray given an incoming direction, the normalized normal and an index of refraction.

  • refractlight

    Computes the illumination of surfaces refracted by the current surface.

  • renderstate

    Queries the renderer for a named property.

  • resolvemissedray

    Returns the background color for rays that exit the scene.

  • scatter

    Evaluates a scattering event through the domain of a geometric object.

  • setcurrentlight

    Sets the current light

  • setsamplestore

    Stores sample data in a channel, referenced by a point.

  • shadow

    Calls shadow shaders for the current light source.

  • shadow_light

    Executes the shadow shader for a given light and returns the amount of shadowing as a multiplier of the shaded color.

  • shimport

    Imports a variable from the shadow shader for the surface.

  • simport

    Imports a variable sent by a surface shader in an illuminance loop.

  • specularBRDF

    Returns the computed BRDFs for the different lighting models used in VEX shading.

  • storelightexport

    Stores exported data for a light.

  • switch

    Use a different bsdf for direct or indirect lighting.

  • trace

    Sends a ray from P along the normalized vector D.

  • translucent

    Returns a Lambertian translucence BSDF.

  • uvunwrap

    Computes the position and normal at given (u, v) coordinates, for use in a lens shader.

  • wireblinn

  • wirediffuse

  • writepixel

    Writes color information to a pixel in the output image

Strings

  • abspath

    Returns the full path of a file.

  • chr

    Converts an unicode codepoint to a UTF8 string.

  • concat

    Concatenate all the strings specified to form a single string.

  • decode

    Decodes a variable name that was previously encoded.

  • decodeattrib

    Decodes a geometry attribute name that was previously encoded.

  • decodeparm

    Decodes a node parameter name that was previously encoded.

  • decodeutf8

    Decodes a UTF8 string into a series of codepoints.

  • encode

    Encodes any string into a valid variable name.

  • encodeattrib

    Encodes any string into a valid geometry attribute name.

  • encodeparm

    Encodes any string into a valid node parameter name.

  • encodeutf8

    Encodes a UTF8 string from a series of codepoints.

  • endswith

    Indicates the string ends with the specified string.

  • find

    Finds an item in an array or string.

  • isalpha

    Returns 1 if all the characters in the string are alphabetic

  • isdigit

    Returns 1 if all the characters in the string are numeric

  • itoa

    Converts an integer to a string.

  • join

    Concatenate all the strings of an array inserting a common spacer.

  • lstrip

    Strips leading whitespace from a string.

  • makevalidvarname

    Forces a string to conform to the rules for variable names.

  • match

    This function returns 1 if the subject matches the pattern specified, or 0 if the subject doesn’t match.

  • opdigits

    Returns the integer value of the last sequence of digits of a string

  • ord

    Converts an UTF8 string into a codepoint.

  • pluralize

    Converts an English noun to its plural.

  • re_find

    Matches a regular expression in a string

  • re_findall

    Finds all instances of the given regular expression in the string

  • re_match

    Returns 1 if the entire input string matches the expression

  • re_replace

    Replaces instances of regex_find with regex_replace

  • re_split

    Splits the given string based on regex match.

  • relativepath

    Computes the relative path for two full paths.

  • relpath

    Returns the relative path to a file.

  • replace

    Replaces occurrences of a substring.

  • replace_match

    Replaces the matched string pattern with another pattern.

  • rstrip

    Strips trailing whitespace from a string.

  • split

    Splits a string into tokens.

  • splitpath

    Splits a file path into the directory and name parts.

  • sprintf

    Formats a string like printf but returns the result as a string instead of printing it.

  • startswith

    Returns 1 if the string starts with the specified string.

  • strip

    Strips leading and trailing whitespace from a string.

  • strlen

    Returns the length of the string.

  • titlecase

    Returns a string that is the titlecase version of the input string.

  • tolower

    Converts all characters in string to lower case

  • toupper

    Converts all characters in string to upper case

Subdivision Surfaces

Tetrahedrons

  • tet_adjacent

    Returns primitive number of an adjacent tetrahedron.

  • tet_faceindex

    Returns vertex indices of each face of a tetrahedron.

Texturing

  • colormap

    Looks up a (filtered) color from a texture file.

  • depthmap

    The depthmap functions work on an image which was rendered as a z-depth image from mantra.

  • environment

    Returns the color of the environment texture.

  • expand_udim

    Perform UDIM or UVTILE texture filename expansion.

  • has_udim

    Test string for UDIM or UVTILE patterns.

  • importance_remap

    Remaps a texture coordinate to another coordinate in the map to optimize sampling of brighter areas.

  • ocean_sample

    Evaluates an ocean spectrum and samples the result at a given time and location.

  • ptexture

    Computes a filtered sample from a ptex texture map. Use texture instead.

  • rawcolormap

    Looks up an unfiltered color from a texture file.

  • shadowmap

    The shadowmap function will treat the shadow map as if the image were rendered from a light source.

  • teximport

    Imports attributes from texture files.

  • texprintf

    Similar to sprintf, but does expansion of UDIM or UVTILE texture filename expansion.

  • texture

    Computes a filtered sample of the texture map specified.

Transforms and Space

  • dihedral

    Computes the rotation matrix or quaternion which rotates the vector a onto the vector b.

  • fromNDC

    Transforms a position from normal device coordinates to the coordinates in the appropriate space.

  • getpackedtransform

    Gets the transform of a packed primitive.

  • getspace

    Returns a transform from one space to another.

  • instance

    Creates an instance transform matrix.

  • lookat

    Computes a rotation matrix or angles to orient the negative z-axis along the vector (to-from) under the transformation.

  • maketransform

    Builds a 3×3 or 4×4 transform matrix.

  • ndcdepth

    Returns the camera space z-depth of the NDC z-depth value.

  • ntransform

    Transforms a normal vector.

  • orthographic

    Create an orthographic projection matrix.

  • ow_nspace

    Transforms a normal vector from Object to World space.

  • ow_space

    Transforms a position value from Object to World space.

  • ow_vspace

    Transforms a direction vector from Object to World space.

  • packedtransform

    Transforms a packed primitive.

  • perspective

    Create a perspective projection matrix.

  • polardecomp

    Computes the polar decomposition of a matrix.

  • prerotate

    Applies a pre rotation to the given matrix.

  • prescale

    Prescales the given matrix in three directions simultaneously (X, Y, Z - given by the components of the scale_vector).

  • pretranslate

    Pretranslates a matrix by a vector.

  • ptransform

    Transforms a vector from one space to another.

  • rotate

    Applies a rotation to the given matrix.

  • rotate_x_to

    Rotates a vector by a rotation that would bring the x-axis to a given direction.

  • scale

    Scales the given matrix in three directions simultaneously (X, Y, Z - given by the components of the scale_vector).

  • setpackedtransform

    Sets the transform of a packed primitive.

  • smoothrotation

    Returns the closest equivalent Euler rotations to a reference rotation.

  • solveconstraint

    Applies an inverse kinematics algorithm to a skeleton.

  • solvecurve

    Applies a curve inverse kinematics algorithm to a skeleton.

  • solvefbik

    Applies a full-body inverse kinematics algorithm to a skeleton.

  • solveik

    Applies an inverse kinematics algorithm to a skeleton.

  • solvephysfbik

    Applies a full-body inverse kinematics algorithm to a skeleton, with optional control over the center of mass.

  • toNDC

    Transforms a position into normal device coordinates.

  • translate

    Translates a matrix by a vector.

  • tw_nspace

    Transforms a normal vector from Texture to World space.

  • tw_space

    Transforms a position value from Texture to World space.

  • tw_vspace

    Transforms a direction vector from Texture to World space.

  • vtransform

    Transforms a directional vector.

  • wo_nspace

    Transforms a normal vector from World to Object space.

  • wo_space

    Transforms a position value from World to Object space.

  • wo_vspace

    Transforms a direction vector from World to Object space.

  • wt_nspace

    Transforms a normal vector from World to Texture space.

  • wt_space

    Transforms a position value from World to Texture space.

  • wt_vspace

    Transforms a direction vector from World to Texture space.

usd

Utility

  • assert_enabled

    Returns 1 if the VEX assertions are enabled (see HOUDINI_VEX_ASSERT) or 0 if assertions are disabled. Used the implement the assert macro.

  • assign

    An efficient way of extracting the components of a vector or matrix into float variables.

  • error

    Reports a custom runtime VEX error.

  • forpoints

  • getcomp

    Extracts a single component of a vector type, matrix type, or array.

  • isbound

    Parameters in VEX can be overridden by geometry attributes (if the attributes exist on the surface being rendered).

  • isvarying

    Check whether a VEX variable is varying or uniform.

  • opend

    Ends a long operation.

  • opstart

    Start a long operation.

  • pack_inttosafefloat

    Reversibly packs an integer into a finite, non-denormal float.

  • print_once

    Prints a message only once, even in a loop.

  • printf

    Prints values to the console which started the VEX program.

  • ramp_lookup

    Evaluates a Houdini-style ramp at a specific location.

  • ramp_pack

    Packs a set of arrays into a string-encoded ramp.

  • ramp_unpack

    Unpacks a string-encoded ramp into a set of arrays.

  • select

    Returns one of two parameters based on a conditional.

  • set

    Creates a new value based on its arguments, such as creating a vector from its components.

  • setcomp

    Sets a single component of a vector or matrix type, or an item in an array.

  • sleep

    Yields processing for a certain number of milliseconds.

  • swizzle

    Rearranges the components of a vector.

  • unpack_intfromsafefloat

    Reverses the packing of pack_inttosafefloat to get back the original integer.

  • warning

    Reports a custom runtime VEX warning.

volume

weightarray