Apple Shake 4 User Manual

Page 943

Advertising
background image

Chapter 31

Expressions and Scripting

943

log10(x)

Returns base 10 log. log10(10) = 1

M_PI

A variable set to pi at 20 decimal places.

max(a,b)

Returns maximum between a and b.

max(5,10) = 10

max3(a,b,c)

Returns maximum between a, b, and c.

max3(5,2,4) = 5

min(a,b)

Returns minimum between a and b.

min(5,10) = 5

min3(a,b,c)

Returns minimum between a, b, and c.

min3(5,2,4) = 2

a%b

Modulus. 27%20 = 7

pow(x,y)

Returns x to the y power. pow(2,4) = 16

round(x)

Rounds number off. Values below x.5 are rounded to x, values
equal to or above x.5 are rounded to x+1. round(4.3) = 4

sqrt(x)

Square root. sqrt(9) = 3

Noise Functions

These are ideal for WarpX and ColorX.

noise(seed)

1-dimensional cubic spline interpolation of noise.

noise2d(seed,seed)

2d noise.

noise3d(seed,seed,seed)

3d noise.

noise4d(seed,seed,seed,seed)

4d noise.

lnoise(seed)

1d linear interpolation of noise.

lnoise2d(seed,seed)

2d noise.

lnoise3d(seed,seed,seed)

3d noise.

lnoise4d(seed,seed,seed,seed)

4d noise.

fnoise(x,xScale)

1d fractal noise based on noise().

fnoise2d(x,y,xScale,yScale)

fnoise3d(x, y, z, xScale, yScale,
zScale)

turbulence(x, xScale)

A cheaper, rougher version of fnoise().

turbulence2d(x, y, xScale, yScale)

Continuous 2d noise.

turbulence3d(x, y, z, xScale,
yScale, zScale)

Continuous 3d noise.

rnd(seed)

Hash-based pseudo-random numbers. Non-hash based RNG (like
rand() or drand48()) should not be used in Shake because they
cannot be reproduced from one machine to another. Also, even on
the same machine, repeated evaluations of the same node at the
same time would produce different results.

rnd1d(seed, seed)

1d random value.

Math Functions

Definition

Advertising