Apple Shake 4 User Manual

Page 942

Advertising
background image

942

Chapter 31

Expressions and Scripting

The following table shows channel variables used in nodes such as ColorX, LayerX,
Reorder, etc. Check the documentation for specific support of any variable.

bytes

The number of bytes in that image. This takes the input bit depth
when called from inside of the node, and the output bit depth
when called from outside of the node.

width

Width of the image. Takes the input width when called from inside
of the node, and the output width when called from outside of the
node.

height

Height of the image. Takes the input height when called from
inside of the node, and the output height when called from
outside of the node.

_curImageName

Returns the name of the actual file being used for the current
frame. Useful when plugged into a Text node:

{FileIn1._curImageName}

dod[0], dod[1], dod[2], dod[3]

The variable for the Domain of Definition (DOD): xMin, yMin, xMax,
yMax, respectively.

Image Variables

Definition

In-Node Variables

Definition

nr, ng, nb, na, nz

New red, green, blue, alpha, Z channel.

r, g, b, a, z

Original red, green, blue, alpha, Z channel.

l

Luminance channel for Reorder.

n

Null channel. Strips out the alpha in Reorder when used like
this: rgbn

r2, g2, b2, a2, z2

Second image’s channel for LayerX.

Math Functions

Definition

abs(x)

Integer absolute value. abs(-4) = 4. Be careful, as this returns an
integer, not a float. Use fabs for float.

biasedGain(value, gain, bias)

Gives a ContrastLum-like curve that gives roll-off between two
values.

cbrt(x)

Cubic root. cbrt(8) = 2

ceil(x)

Truncates to next integer. ceil(5.3) = 6

clamp(x, lo, hi)

Clamps x to between lo and hi.

clamp(1.5,0,1) = 1

exp(x)

Natural exponent. exp(0) = 1

fabs(x)

Float absolute value. fabs(-4.1) = 4.1

floor(x)

Truncates to next lowest integer. floor(5.8) = 5

fmod(x,y)

Float modulus. Returns the remainder in float. fmod(11.45,3) = 2, for
example, (3x3+2.45 = 11.45)

log(x)

Natural log. log(1) = 0

Advertising