![]() |
VEX Language Reference - Version 7.0Side Effects Software Inc. 2004 |
abs computes the absolute value of the argument.
acos computes the arc-cosine of the argument. The return
value is in the range 0 to PI.
asin computes the arc-sine of the argument. The return value
is in the range -PI/2 to PI/2.
atan computes the arc-tangent of the argument. The return
value is in the range -PI/2 to PI/2. When two floats are passed,
the function behaves as atan2()
atan2 returns the arc-tangent of y/x and has a return value in
the range -PI to PI
ceil returns the smallest integer greater than or equal to
the argument
cos computes the cosine of the argument.
cosh computes the hyperbolic cosine of the argument.
degrees converts the argument from radians into degrees
exp computes the exponential function of the argument.
floor returns the largest integer less than or equal to the
argument
frac returns the fractional component of the floating point
number. This is equivalent to (x - floor(x)).
int if the argument is negative, this returns ceil(x),
otherwise it returns floor(x).
log computes the natural logarithm of the argument
log10 computes the logarithm (base 10) of the argument
pow raises the first argument to the power of the second
argument
radians converts the argument from degrees into radians
rint rounds the number to the closest integer.
sin computes the sine of the argument
sinh computes the hyperbolic sine of the argument
sqrt computes the square root of the argument
tan computes the trigonometric tangent of the argument
tanh computes the hyperbolic tangent of the argument
float dot( vector4 a; vector b),
float length( vector ),
vector normalize( vector )
float avg( vector )
vector cross( vector a, b )
vector4 clamp( vector4 value, min, max),
float fit( float value, omin, omax, nmin, nmax)
vector4 lerp( vector4 value1, value2; float amount),
float smooth( float value1, value2, amount, rolloff),
vector4 cspline( float t; vector4 val1, ... ),
vector4 lspline( float t; vector4 val1, ... ),
vector4 ckspline( float t; vector4 val1; float key1; vector4 val2; float
key2, ... ),
Because of the nature of the Cardinal spline, the value associated
with the first and last keys will never be returned. However,
these keys are used to determine the shape of the curve on entry
and exit. For example:
vector4 lkspline( float t; vector4 v1; float k2;
vector4 v2; float k2; ... ),
float ptlined(vector P0, P1, Q)
vector fresnel( vector i, n; float eta; float &kr, &kt)
As a note, kt is scaled by the index of refraction
(eta) which can cause the value to be non-intuitive. To
change this behaviour, simply divide the kt returned from
the fresnel function by the index of refraction passed
in.
vector frontface( vector N, I, Nref)
vector reflect( vector direction, normal)
vector refract( vector direction, normal; float index)
float luminance( vector ), float luminance( float r, g, b)
vector rgbtohsv( vector ), vector rgbtohsv( float h, s, v)
The noise has a range of (0, 1) with a median value of 0.5. The
distribution of the noise depends on the dimension, with higher
dimensions approaching a Gaussian distribution of noise values.
The general form of the wnoise functions is:
The distances returned will be sorted from closest to farthest,
meaning that the following identity is true:
It is then possible to combine these distances to generate noise
patterns. The noise generated tends to be very "cellular" in nature,
in fact, one of the nice things is that you can determine "cell"
boundaries by using the expression:
The general form of the wnoise functions is:
Though this function is slightly more expensive than wnoise,
the fact that the actual point posisitions are returned allows the
function to overcome some of the artifacts of Worley noise. For
example, to get even boundaries along the cell boundaries:
There are also periodic forms of vnoise()
For example:
The bounds on the noise are roughly (-1, 1). Only 3D noise is
supported. However, this noise has the ability to compute turbulence
with roughness and attenuation on the noise.
The bounds on the noise are roughly (-1.7, 1.7). Only 3D noise is
supported. However, this noise has the ability to compute turbulence
with roughness and attenuation on the noise.
The bounds on the noise are roughly (-1, 1). Only 3D noise is
supported. However, this noise has the ability to compute turbulence
with roughness and attenuation on the noise.
These random functions will generate a random number based on the
position in N dimensional space (where N is 1 to 4 dimensions).
Unlike the noise functions which smoothly interpolate the random
values between integer lattice points, the random functions do not.
The random() functions are very efficient ways of doing something
like: noise(floor(position)).
The hscript_rand() function will produce the exact same
results as the Houdini expression function of the same name. This
function will generate different random values for every floating
point seed. This is different that the random() function which
converts the floating point argument to an integer seed. The
hscript_rand() function may produce different results on
different hardware or operating systems.
The nrandom() functions are non-deterministic random number generators
for VEX. Numbers generated will be between 0 and 1. These random
generators will generate the same sequence of random numbers if called
in precisely the same order. However, there is no seed involved so it
is not possible to reproduce the same random number or sequence
multiple times.
An optional string argument is taken to determine the random number
generation method. The string may be one of:
There are corresponding versions of each of the above functions which
do not use bilinear interpolation of the raw pixel values. These
function names are prefixed with "raw". For example:
All of the colormap functions are variadic (meaning they take
variable number of arguments). Additional arguments can be used to
specify filtering options for the texture. These arguments must be
defined at load time. That is, the arguments must be constants or
parameters. The additional arguments are:
Bump maps will return the color gradient of the image in the
du/dv parameters. There are 6 different forms of the bump map
function differentiated by the trailing character of the function
name. The functions will compute the gradient based on:
The du/dv parameters will be in the range (-1, 1).
The depthmap functions work on an image which was rendered as a z-depth
image from mantra. They return the floating point distance from the
camera to the pixel in question. There is no area sampling done when
sampling depth values. As well, if the u/v values are not in the
range 0 to 1, a value of 1E6 will be returned (indicating a "far"
value).
The shadowmap function will treat the depth map as if the
image were rendered from a light source. The Pndc parameter represents
the position of the point being shaded in the NDC space of the light's
projection. The spread is a softness control on the shadow, while
the bias controls how accurate the depth samples need to be. The
quality is a general control to increase/decrease sampling. A
quality of 1 is typical quality. The fractional amount of
illumination which reaches the sample point will be returned. For
example, if the point is fully in shadow, the return value will be 0,
if it is fully illuminated, the return value will be 1.
Texture files will be searched for in the path specified by the
HOUDINI_TEXTURE_PATH environment variable.
Additional arguments may be specified to control the evaluation:
The point p0 will be modified regardless of whether an
intersection is found or not.
Additional arguments may be specified to control the evaluation:
Additional arguments may be specified to control the integration:
Caveat: The vector forms of this function don't deal with
termination as precisely as the scalar form.
If the limit is not reached during the integration, then
the function will return 0 and the value of p0 will be set to
the value of p1.
Caveats:
Additional arguments may be specified to control the
integration:
A point cloud texture is simply a collection of points in space. Each
point has several channels associated with the texture. For
example, the texture might have a P channel to indicate the
position of the point, or a temperature to indicate the
temperature at the point.
When a geometry file is used as a source for the point cloud, each
point attribute is available as a read-only channel.
It is also possible to create temporary read-write channels. These
channels allow information to be stored in the point cloud and re-used
by later computations. The information in these temporary channels is
maintained while the texture is still referenced by any VEX function.
That is, if two VEX functions reference the same texture, any
temporary channels will be shared between the two functions. If the
texture is flushed from the texture cache, then all temporary channels
will also be flushed and information will need to be re-computed.
Given a query point in space, the VEX functions provided allow the
user to find the closest points and operate on them.
An example of how a point cloud texture might be used is in a simple
occlusion map caching shader.
Optionally, the Nchannel specifies a direction channel and the
N parameter specifies a search direction. Only points which
are pointed in the same direction (i.e. dot(N, Npoint) > 0)
will be found in the search.
The prefix parameter is used when referencing tiled block
files and is used to specify the channel prefix used in the file.
WARNINGS:
WARNINGS:
NOTE: When intersections are performed against metaball geometry,
it is impossible to determine the primitive number of the metaball
which was hit. In this case, the function returns the number of
primitives in the intersection geometry.
The first time the function is called, the index parameter
should be set to -1 and the p0 and p1
variables should be set to the end-points of the ray. If an
interval was found, the function will return 1 and the p0
and p1 variables will be set to the end-points of the
interval. Otherwise the function will return 0 and the
p0/p1 variables will be unchanged.
On subsequent calls to the function, the value of index
will be modified by the function and any additional interesting
intervals will be returned. Thus, the function can be used to
ray-march through just areas of interest, skipping the dead space.
In the SOP and POP context, all variables are in "object" space to
begin with. Transforming the variables into "world" space will apply
the transform of the object containing the SOP to the variables.
There are a set of VEX functions to transform positions, direction
vectors and normals into other spaces. The techniques for
transforming each type of vector are subtly different, so it is
important to use the correct transformation (depending on what the
entity represents).
The format string is a simpler version of the C printf format
string. When a % symbol is found in the string, an
argument will be printed out in a format specified by the
characters following the % symbol. The conversion of the
argument is specified by a single letter: g, f, s, d, x, c,
p. It is possible to prefix the format option with an
optional width specification. It is also possible to use an
asterix (*) to cause the width option to be read from the
next argument. If the specified field width begins with a 0,
leading spaces will be replaced with leading zeros.
The format characters supported are:
Examples:
float dot( vector a; vector4 b),
float dot( vector a, b)
Computes the dot product between the arguments. When 4 component
vectors are specified, only the first three components are
taken into consideration.
float length2( vector )
float length( vector4 )
float length2( vector4 )
Computes the length of the vector or vector4.
length2 returns the squared distance.
Returns the normalized vector
float max( vector )
float min( vector )
Returns the average of the 3 components, the maximum of the 3
components or the minimum of the 3 components of the vector.
Computes the cross product between the two vectors
Interpolation Functions
float max( float a, b, ... )
Returns the minimum or maximum value of the parameters. Any
number of parameters may be specified
vector clamp( vector value, min, max),
float clamp( float value, min, max),
int clamp( int value, min, max )
Each component of the vector is clamped between the minimum and
maximum values
vector fit( vector value, omin, omax, nmin, nmax)
vector4 fit( vector4 value, omin, omax, nmin, nmax)
Takes the value in the rangeo (omin, omax) and shifts it to the
corresponding value in the new range (nmin, nmax). For example:
Would return the value 13.
vector lerp( vector value1, value2; float amount),
float lerp( float value1, value2; float amount)
Performs bilinear interpolation between the values. If the amount
is outside the range 0 to 1, the values will be extrapolated
linearly.
float smooth( float value1, value2, amount)
Computes a number between zero and one. The return code is 0 if
the amount passed in is less than or equal to value1, 1 if the
amount is greater than or equal to value2. If the amount is
between value1 and value2, a smooth (easin/easeout) interpolation
is computed. If a rolloff is specified, the inflection point of
the blend will be shifted. If the rolloff is greater than 1, the
shift will be to the right, if the rolloff is less than 1 (and
greater than 0), the shift will be to the left.
vector cspline( float t; vector val1, ... ),
float cspline( float t; float val1, ... )
Computes a Catmull-Rom (Cardinal) spline between the key points
specified. The keys are uniformly spaced over the range 0 to 1.
Because of the nature of the Cardinal spline, the value associated
with the first and last keys will never be returned. However,
these keys are used to determine the shape of the curve on entry
and exit.
vector lspline( float t; vector val1, ... ),
float lspline( float t; float val1, ... )
Computes a linear spline between the key points. This is
equivalent to a sequence of lerp() functions.
vector ckspline( float t; vector val1; float key1; vector val2; float
key2, ... ),
float ckspline( float t; float val1; float key1; float val2; float
key2, ... )
Computes a Catmull-Rom (Cardinal) spline between the key points
specified. The values are spaced according to the keys given.
The domain of the interpolant (t) should be between the second and
second last key value specified. The keys should be specified in
ascending order or results will be unpredictable.
vector lkspline( float t; vector v1; float k1;
vector v2; float k2; ... ),
float lkspline( float t; float v1; float k1;
float v2; float k2; ... )
Computes a linear spline between the key points. The values are
spaced according to the keys given. The keys should be specified
in ascending order or the results will be unpredictable.
Matrix Functions
matrix3 dihedral( vector a, b)
matrix ident( void ), matrix3 ident( void )
matrix invert( matrix ), matrix3 invert( matrix3 )
matrix3 lookat( vector from, to, up),
matrix3 lookat( vector from, to; float roll),
matrix3 lookat( vector from, to)
void rotate( matrix &; float amount; vector axis),
void rotate( matrix3 &; float amount; vector axis)
void scale( matrix &; vector scale_vector),
void scale( matrix3 &; vector scale_vector)
void translate( matrix &; vector4 amount),
void translate( matrix &; vector amount)
void transpose( matrix & ),
void transpose( matrix3 & )
matrix maketransform(int trs, xyz; vector t, r, s, p)
matrix maketransform(int trs, xyz; vector t, r, s)
matrix3 maketransform(vector zaxis, xaxis)
matrix maketransform(vector zaxis, xaxis; vector translate)
vector vtransform(vector v; matrix xform)
vector cracktransform(int trs, xyz, c; vector p; matrix xform)
determinant computes the determinant of the matrix
dihedral computes the rotation matrix which rotates the
vector a onto the vector b.
ident computes identity matrices
invert inverts the matrix. If the matrix is singular, the
original matrix is returned.
lookat computes a rotation matrix to orient the z-axis along
the vector (to-from) under the transformation. If an up
vector is specified, this will determine the roll.
rotate applies a rotation to the given matrix. The angle must be
given in radians and the axis must be normalized.
scale scales the given matrix in three directions
simultaneously (X, Y, Z - given by the components of the
scale_vector).
translate will apply a translation to the given matrix
transpose will transpose the given matrix
maketransform(int trs, xyz, ...) Builds a general 4x4
transform matrix given an order of transformations (trs), an
order for rotations (xyz), a vector representing the
translation (t), rotation (r), scale (s)
(and optionally a pivot (p)). The specifications for
the trs and xyz parameters can be found in
$HFS/houdini/vex/include/math.h
maketransform(vector zaxis, xaxis, ...) Builds either a 3x3
transform matrix or a 4x4 transform matrix. The transform
matrix will be constructed so that applying the matrix will
transform the z-axis to the axis specified and the x-axis to
the axis specified. The version which returns a 4x4 transform
will apply the translation to the 4x4 matrix. This function
is very similar to the lookat function. The vectors
passed in are not normalized meaning that scales should
be preserved in construction of the transform.
vtransform
The * operator on a vector multiplied by a transform
matrix assumes that the vector represents positional
information. If the vector represents directional
information, the vtransform function will do the
correct multiplication. Basically, the translations
associated with the 4x4 matrix will not be applied to the
transform.
cracktransform
Depending on the value of c, returns the translate
(c=0), rotate (c=1), or scale (c=2)
component of the transform (xform). The function uses
the given transform and rotation orders (trs and
xyz) and the given pivot point (pivot) to
calculate the return value. The specifications for the
trs and xyz parameters can be found in
$HFS/houdini/vex/include/math.h.
Geometric Functions
void clip( int &result, vector &p0, &p1; vector4 plane)
The clip functions will clip the line segment between p0 and p1.
The first form will clip the line segment to the bounding box
specified by the min & max corner points.
The second form will clip the line segment against an arbitrary 3D
plane specified by the plane equation (plane.x*x + plane.y*y +
plane.z*z + plane.w).
If the line is entirely clipped out of the result will be set to
0. otherwise, the values p0 and p1 will be clipped to the
constraints specified and the result will be 1.
This function returns the closest distance between the point Q and
a finite line segment between points P0 and P1.
Rendering Functions
Computes attenuated falloff. This is equivalent to:
attenuation/(attenuation+distance).
vector fresnel( vector i, n; float eta; float &kr, &kt;
vector &R, &T)
Computes the fresnel reflection/refraction contributions given an
incoming vector, surface normal (both normalized), and an index of
refraction (eta). The amount of reflected light will be returned
in Kr, and the amount of transmitted light will be returned in Kt.
Optionally, the reflection and transmission vectors can be
returned in the R and T variables. The R & T variables will be
normalized vectors on exit.
vector frontface( vector N, I)
If dot(I, Nref) is less than zero, N will be negated. The
second form (which doesn't take a reference vector) is only
available in the shading contexts, where the Ng variable is
used.
Returns the vector representing the reflection of the direction
against the normal.
Computes the refraction ray given an incoming direction, the
normalized normal and an index of refraction
Color Functions
Convert HSV color space into RGB color space. A vector
representing the RGB triple is returned. The hue should be in the
range 0 to 1.
Compute the luminance of the RGB color specified by the parameters
Convert RGB color space to HSV color space. A vector representing
the HSV color is returned. The hue will be in the range 0 to 1.
String Functions in VEX
Concatenate all the strings specified to form a single string.
This is equivalent (but slightly more efficient when there are
more than 2 strings) to adding all the strings together.
This function computes the length of the string given.
Noise Functions in VEX
Cost
Noise Type
1.0
Perlin Noise
1.1
Original Perlin Noise
1.8
Worley Noise
2.1
Sparse Convolution Noise
2.3
Alligator Noise
Perlin Noise Functions
Dimen.
Scalar
Vector
Periodic Scalar
Periodic Vector
1D
float
noise(float x)vector
noise(float x)float
pnoise(float x;vector
pnoise(float x;
2D
float
noise(float x, y)vector
noise(float x, y)float
pnoise(float x, y; vector
pnoise(float x, y;
3D
float
noise(vector)vector
noise(vector)float
pnoise(vector;
pnoise(vector pos, p)vector
pnoise(vector;
pnoise(vector pos, p)
4D
float
noise(vector4)vector
noise(vector4)float
pnoise(vector4;
pnoise(vector4 pos, p)vector
pnoise(vector4;
pnoise(vector4 pos, p)
Worley Noise Functions
where position is either a single float (1D noise), two floats (2D
noise), a vector (3D noise) or a vector4 (4D noise). The seed is
returned in the integer parameter, and the N closest points are
returned in f1...fN (where N is 2 or 4).
which will be true if the point in space is crossing the boundary
between two cells.
Voronoi Noise Functions
where position, jitter, pos1 and pos2 are a single float (1D noise),
two floats (2D noise), a vector (3D noise) or a vector4 (4D noise).
The seed is returned in the integer parameter, and the distance to
pos1 and pos2 are returned in f1 and f2.
which will "normalize" the boundary width based on the distance
between the two random points in space.
Original Perlin Noise Functions
Sparse Convolution Noise Functions
Alligator Noise Functions
Hscript Noise Functions
Random Number Functions in VEX
vector4 random(vector position)
vector4 random(float xpos, float ypos)
vector4 random(float position)
vector4 random(int xpos, int ypos)
vector4 random(int position)
vector random(vector4 position)
vector random(vector position)
vector random(float xpos, float ypos)
vector random(float position)
vector random(int xpos, int ypos)
vector random(int position)
float random(vector4 position)
float random(vector position)
float random(float xpos, float ypos)
float random(float position)
float random(int xpos, int ypos)
float random(int position)
float hscript_rand(float seed)
Non-Deterministic Random Number Functions in VEX
vector nrandom([string scheme])
float nrandom([string scheme])
default
Efficient random number generation. This method is
backward compatible with previous releases of Houdini.
mersenne
or twisterUses the Mersenne Twister which has some very nice
properties. This code is based of the work of:
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji
Nishimura,
All rights reserved.
Image Functions in VEX
General Notes
Color Image Functions
This function will lookup a single sample of from the filename given.
The first two components of the vector are used to reference the
image (in 0 to 1 space). No area sampling is done, but bilinear
interpolation is done on raw pixel values.
This function will lookup a single sample of from the filename given.
The first two components of the vector are used to reference the
image (in 0 to 1 space). No area sampling is done, but bilinear
interpolation is done on raw pixel values.
This function will sample the area enclosed by the quadrilateral
(uv0),(uv1),(uv2),(uv3). The quadrilateral will be sampled
stochastically using the number of samples passed in (unless the
image is a .rat file). Each sample will use bilinear
interpolation on raw pixel values.
This function will filter the area of the image enclosed by the
quadrilateral formed by (uv)-(uv+du)-(uv+du+dv)-(uv+dv). The
quadrilateral will be sampled stochastically using the number of
samples specified (unless the image is a .rat file). Each sample
will use bilinear interpolation on raw pixel values.
This function will filter the area of the image enclosed by the
quadrilateral formed by (uv0)-(uv1)-(uv2)-(uv3). The
quadrilateral will be sampled stochastically using the number of
samples specified (unless the image is a .rat file). Each sample
will use bilinear interpolation on raw pixel values.
Image Map Filter Arguments
Keyword
Values
wrap or
mode
Puts constraints on how the image is evaluated when the
texture coordinates are outside the range 0 to 1.
uwrap or
swrap orsmode Specifies the behaviour when the u coordinate is
outside the range 0 to 1. The values are the same as
with wrap.
vwrap or
twrap ortmode Specifies the behaviour when the v coordinate is
outside the range 0 to 1. The values are the same as
with wrap.
border
Specifies the border color when Black/Decal/Color
wrapping is used. The value following this argument
should be a float, vector or vector4 argument. If not
specified, the border color will be black (i.e. 0) by
default.
filter
Specifies the type of anti-aliasing filter to be
used for evaluation. The following argument should be a
string specifying one of:
point
- Point sampling (i.e. no filtering)
box
- Box filter (default)
gauss
- Gaussian filter
bartlett
- Bartlett/Triangular filter
sinc
- Sinc sharpening filter
hanning
- Hanning filter
blackman
- Blackman filter
catrom
- Catmull-Rom filter
xfilter or
sfilter or
ufilter Specifies the filter for the x direction. The filter can
be any one of those listed above.
yfilter or
tfilter or
vfilter Specifies the filter for the y direction. The filter can
be any one of those listed above.
width
Specifies the filter width in both x and y directions.
The following argument should be a float value.
swidth or
xwidth or
uwidth Specifies the filter width only in the x direction.
twidth or
ywidth or
vwidth Specifies the filter width only in the y direction
extrapolate
Specifies whether derivative extrapolation should be used
when computing anti-aliasing information. Extrapolation of
derivatives is on by default. The argument should be either 0
or 1.
lerp
Specifies whether RAT files should interpolate between
different MIP levels. By default, this is turned off.
Turning interpolation on will help remove discontinuities when
different MIP levels of a .rat file are accessed. However,
the results of texture evaluation will be slightly softer
(i.e. blurrier) and will take more time. The argument should
be either 0 or 1.
Examples of specifying filter parameters:
Bump Map Functions
Z-Pic Depth Image Functions
float depthmap(string filename; float u, v)
float shadowmap(string filename; vector Pndc; float spread, bias, quality)
3D Image Functions
"nphotons"
Specifies the number of photons to use in the
filtering process. This specifies the maximum number of
photons which will be filtered to produce the final
color.
The default is 50 photons.
"type"
This parameter specifies how the photons should be
interpreted. There are two possibilities for the type of
photon filtering:
The default is "diffuse".
"error"
Specifies the "accuracy" for the lookup of photons in
the photon map. This parameter determines the search
radius to find photons in the map. Larger numbers will
result in less accurate evaluations (i.e. smaller areas of
the map will be scanned), while smaller number will result
in larger areas of the map being scanned. The cost of
filtering goes up as the error tolerance is decreased
(meaning renders will take longer).
The default 0.001.
"filter"
Specifies the "filter" for computing the irradiance
from photons. When evaluating photon contributions, the
incoming radiance is divided by the area that the photons
cover (to determine the flux). The area can be computed
in three different fashions:
The default is "sphere".
vector texture3d(string filename, channel; vector P, ...);
vector4 texture3d(string filename, channel; vector P, ...);
Returns the value of the 3d image at the position specified by
P. If P is outside of the bounding box of the
image, the value returned will be 0. If the channel specified
contains more values than the return type (i.e. a vector channel
when a float return type is desired), the first component of the
vector will be returned. If the channel specified contains fewer
values than the return type, the missing components will be
filled with the last valid channel.
"filter"
Specifies the filter for evaluation.
"width"
Specifies the filter width for evaluation.
Returns the gradient of a single channel texture image at the
position specified by P. If P is outside of the
bounding box of the image, the value returned will be 0. If the
channel specified contains more values than the return type (i.e.
a vector channel when a float return type is desired), the
gradient of the first component of the vector will be returned.
Additional arguments may be specified to control the evaluation:
"filter"
Specifies the filter for evaluation.
"width"
Specifies the filter width for evaluation.
This function intersects a ray (with it's origin at p0 and
extending to p1), against a 3d texture image. The ray will
intersect the iso-surface of the texture at the density
specified. If no intersection is found, then 0 is returned.
"filter"
Specifies the filter for evaluation.
"width"
Specifies the filter width for evaluation.
vector integrate3d(string filename, channel;
vector p0, p1, ...)
vector4 integrate3d(string filename, channel;
vector p0, p1, ...)
This function will "integrate" the 3d image along the line
specified by p0 and p1.
"maxlimit"
Terminate the integration if the computed sum exceeds
the value specified. This option should not be used if
the 3d image contains both positive and negative values as
the integration my terminate prematurely. "accuracy"
Determine the accuracy of integration. If the
accuracy is less than 1, limited filtering is done. If
the accuracy is greater than 1 higher quality sampling is
performed. The default value is 0. Please be cautioned
that accurate filtering can be 10 times as expensive for
even simple data sets.
"iscale"
Scale the value of the image by the value specified
during the integration
"filter"
Specifies the filter for evaluation.
"width"
Specifies the filter width for accurate integration.
For example:
This function queries the 3D texture map specified and returns
the bounding box information of the file. The bounding box is
returned in the vectors min and max.
The integrate3dClip function integrates along the ray
described by p0 and p1 where "interesting" things
start happening in a given I3D texture. It works by marching
along the given ray, integrating the value of channel in
the 3d texture space until the sum of the integration reaches
the limit. At that point, it stops and sets the value of
p0 to be the point where limit was reached and
returns 1.
"accuracy"
Determine the accuracy of integration. If the
accuracy is less than 1, limited filtering is done. If
the accuracy is greater than 1 higher quality sampling is
performed. The default value is 0. Please be cautioned
that accurate filtering can be 10 times as expensive for
even simple data sets.
"iscale"
Scale the value of the image by the value specified
during the integration
"filter"
Specifies the filter for evaluation.
"width"
Specifies the filter width for accurate integration.
For example:
Point Cloud Texture Functions
This function returns a handle to the file specified. The
file may use the op: syntax to reference SOP geometry in the OP
contexts. The Pchannel parameter indicates the channel in the
texture which contains the position to be searched. The P
parameter specifies the search query position. Only the
maxpoints closest points within the sphere of the given
radius will be found.
Returns the distance to the farthest point found in the search
performed by pcopen. If no points were found, the function
will return a very large value (1e37)
vector pcfilter(int handle; string channel)
vector4 pcfilter(int handle; string channel)
matrix3 pcfilter(int handle; string channel)
matrix pcfilter(int handle; string channel)
Filters the points found using a simple reconstruction filter. This
function is roughly equivalent to:
This function can be used to iterate over all the points which were
found in the pcopen query. The function returns 1 while
there are points left in the iteration loop, or 0 when there are no
further points.
This function can be used to iterate over all of the points of a
read-write channel which haven't had any data written to the
channel yet. The function works just like the
pciterate function in that 1 is returned while there are
still points left unshaded.
Geometry Functions in VEX
Returns the bounding box of the geometry specified by the
filename. The point corresponding to the minimum corner of the
bounding box will be returned in min, while the maximum
will be in max. The function returns 1 if successful, or 0
if it wasn't possible to load the geometry.
Returns the number of points for all primitives in the geometry
file
Returns the number of primitives in the geometry file
This function computes the intersection of the specified ray with
the geometry. The primitive number is returned or in the result
of an error, has a value of -1. The world position of the
intersection location is stored in (p). The corresponding
parametric location of the intersection is stored in (u),(v). In
the case of multiple intersections, the intersection closest to
the ray origin is used.
Returns the metaweight of the geometry at position (p).
This function will take the ray defined by p0 and p1
and partition the ray into zero or more sub-intervals. Each
interval will intersect a cluster of metaballs from the file
filename. The interval may not actually intersect any
metaballs, but will provide fairly tight bounds on the cluster.
This allows a ray-marching algorithm to "skip" uninteresting areas
and only focus on marching through areas where metaballs might be
found.
int metanext(int handle)
int metaimport(int handle; string attrib; vector P; float &value)
int metaimport(int handle; string attrib; vector P; vector &value)
int metaimport(int handle; string attrib; vector P; vector4 &value)
int metaimport(int handle; string attrib; vector P; matrix3 &value)
int metaimport(int handle; string attrib; vector P; matrix &value)
These functions allow querying of metaball geometry on a
per-metaball basis. The semantics are that metastart will
open a geometry file and return a "handle" to the geometry. The
handle contains a list of all the metaballs of interest at the
position specified in the metastart() function. The
metanext function will move the handle to the next metaball
for evaluation. The metaimport function provides a
mechanism to query attributes of the metaball. There are
currently three "special" attributes which can be queried:
Name
Meaning
Data Type
"meta:density"
The density of the current metaball
float
"meta:prim"
The primitive number of the current metaball
float
"meta:transform"
The transform associated with the current metaball.
Applying the inverse of this transform will transform a
point into the "space" of the metaball.
matrix
Transformation Functions in VEX
vector ow_space( vector )
Transforms a position value from Object to World space.
vector wo_space( vector )
Transforms a position value from World to Object space.
vector tw_space( vector )
Transforms a position value from Texture to World space.
vector wt_space( vector )
Transforms a position value from World to Texture space.
Transforms a normal vector from Object to World space.
Transforms a normal vector from World to Object space.
Transforms a normal vector from Texture to World space.
Transforms a normal vector from World to Texture space.
Transforms a direction vector from Object to World space.
Transforms a direction vector from World to Object space.
Transforms a direction vector from Texture to World space.
Transforms a direction vector from World to Texture space.
Transforms a position into normal device coordinates. This space
is really only well defined for
Displacement, Surface and Light contexts.
Transforms a position from normal device coordinates to the
coordinates in the appropriate space. NDC space is really only
well defined for Displacement,
Surface and Light contexts.
Miscellaneous Functions
string sprintf( string format, ...)
Prints values to the starting console.
%g, %p, %c
Print an integer float, vector, vector4, matrix3, matrix
or string in "general" form.
%f
Print a float, vector, vector4, matrix3 or matrix in
floating point form.
%s
Print a string variable
%d
Print an integer variable in decimal
%x
Print an integer variable in hexidecimal
%%
Print a % symbol
Will give up processor cycles for N milliseconds.
477 Richmond Street West, Toronto, Ontario, Canada M5V 3E7