wnoise
VEX function
Worley noise scatters points randomly through space (according to a nice Poisson distribution).
Contexts: image3d, chop, cop, pop, sop, surface, displace, fog, light, shadow, photon, cvex
-
void wnoise(float , int &, float &, float &) -
void wnoise(vector , int &, float &, float &) -
void wnoise(vector4 , int &, float &, float &) -
void wnoise(float , int &, float &, float &, int ) -
void wnoise(float , float , int &, float &, float &) -
void wnoise(float , int &, float &, float &, float &, float &) -
void wnoise(vector , int &, float &, float &, float &, float &) -
void wnoise(vector4 , int &, float &, float &, float &, float &) -
void wnoise(float , int &, float &, float &, float &, float &, int ) -
void wnoise(float , float , int &, float &, float &, int , int ) -
void wnoise(float , float , int &, float &, float &, float &, float &) -
void wnoise(vector , int &, float &, float &, int , int , int ) -
void wnoise(vector4 , int &, float &, float &, int , int , int , int ) -
void wnoise(float , float , int &, float &, float &, float &, float &, int , int ) -
void wnoise(vector , int &, float &, float &, float &, float &, int , int , int ) -
void wnoise(vector4 , int &, float &, float &, float &, float &, int , int , int , int )
Worley noise scatters points randomly through space (according to a nice Poisson distribution). The wnoise functions return the distance to the N closest points (where N is either 2 or 4). They also return a “seed” which is associated with the first closest point. This seed is pretty much guaranteed to be unique for every point (meaning that it’s unlikely that two points close by have the same seed associated with them).
The general form of the wnoise functions is:
void wnoise(position; int &seed; float &f1, &f2) void wnoise(position; int &seed; float &f1, &f2, &f3, &f4)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).
The distances returned will be sorted from closest to farthest, meaning that the following identity is true: f1 <= f2 <= f3 <= f4
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: if (f2 - f1 which will be true if the point in space is crossing the boundary between two cells.
See noise and randomness in the VEX language guide for more information.