Skip to content

Alligator Noise

Provided VEX function already gives us most of the options that you are used to see in vops.

float  anoise(vector pos)
vector  anoise(vector pos)
float  anoise(vector pos, int turbulence, float rough, float atten)
vector  anoise(vector pos, int turbulence, float rough, float atten)
float  anoise(vector pos, int periodX, int periodY, int periodZ)
vector  anoise(vector pos, int periodX, int periodY, int periodZ)
float  anoise(vector pos, int periodX, int periodY, int periodZ, int turbulence, float rough, float atten)
vector  anoise(vector pos, int periodX, int periodY, int periodZ, int turbulence, float rough, float atten)

Missing part is frequency, offset and amplitude.

Frequency is just a scale factor of incoming value, so we can simply multiply input the input.

Offset is shifting out input, therefore we can just add or subtract it. To match VOP behaviour, we should use subtract.

Amplitude is total scale of the output noise, so simple multiplication will do the trick.

Here is a code matching same behaviour as VOP counterpart:

VEXpression
vector pos = v@P;
vector frequency = chv("Frequency");// default (1,1,1)
vector offset = chv("Offset");// default (0,0,0)
int turbulence = chi("Turbulence");// default 5
float rough = chf("Roughness");// default 0.5
float atten = chf("Attenuation");// default 1
float amplitude = chf("Amplitude");// default 1

vector alligator = anoise((pos*frequency)-offset, turbulence,  rough, atten);
alligator *= amplitude;
v@P += alligator;