The following functions are defined by Radiance.
Builtin Functions |
|
cos(a) | Returns the cosine of a. |
acos(a) | Returns the arc cosine of a. |
sin(a) | Returns the sine of a. |
asin(a) | Returns the arc sine of a. |
tan(a) | Returns the tangent of a. |
atan(a) | Returns the arc tangent of a. |
atan2(a, b) | Returns atan(a/b). |
ceil(a) | Returns the next higher integer for a. |
floor(a) | Returns the next lower integer for a. |
exp(a) | Returns the exponent of base e with a (ea). |
sqrt(a) | Returns the square root of a. |
log(a) | Returns the natural logarithm of a. |
log10(a) | Returns the base-10 logaritm of a. |
if(a, b, c) | Returns b if a is greater than zero, else c. |
select(a, b, c... n) | Returns the element of the list [b, c... n] with the index a (first index is 0). |
rand(x) | Returns a pseudo random number between 0.0 and 1.0, based on the seed x. |
arg(a) | Returns the value of the real argument number a from the current modifier primitive. arg(0) returns the number of available real arguments. |
erf(x) | Error function for x. |
erfc(x) | 1.0 - erf(x). This function is provided because there is an extreme loss of relative accuracy if erf(x) is called for large x and the result subtracted from 1. |
hermite(a, b, c, d, e) | 1-dimensional hermite polynominal. |
noise3(a, b, c) | Perlin noise function with gradient (-1 to 1). |
noise3x(a, b, c) | Partial derivative of perlin noise function with gradient (-1 to 1). |
noise3y(a, b, c) | Partial derivative of perlin noise function with gradient (-1 to 1). |
noise3z(a, b, c) | Partial derivative of perlin noise function with gradient (-1 to 1). |
fnoise(a, b, c) | Fractal noise function (-1 to 1). |
Builtin Variables for All Types |
|
Dx Dy Dz | Incident ray direction vector. |
Px Py Pz | Intersection point with the incident ray. |
Nx Ny Nz | Surface normal at the intersection point. |
Tx Ty Tz | World origin (in object coordinates). |
Ix Iy Iz | World i unit vector. |
Jx Jy Jz | World j unit vector. |
Kx Ky Kz | World k unit vector. |
T | Distance from start (cumulated distance from the image plane). |
Ts | Single ray (shadow) distance. |
S | World scale (eg. for instances). |
Rdot | Ray dot product. |
Builtin Variables for BRDF Types |
|
NxP NyP NzP | Perturbed surface normal vector. |
RdotP | Perturbed ray dot product. |
CxP CyP CzP | Perturbed material color. |
Builtin Variables for prism# Types |
|
DxP DyP DzP | Direction of target light source. |
The file rayinit.cal defines a number of utility functions that are available in every context.
Global Functions |
|
noise3a(a, b, c) | Synonym for the builtin noise3x, available for backward compatibility. |
noise3b(a, b, c) | Synonym for the builtin noise3y, available for backward compatibility. |
noise3c(a, b, c) | Synonym for the builtin noise3z, available for backward compatibility. |
noise3d(i, a, b, c) | select(i, noise3x(x,y,z), noise3y(x,y,z), noise3z(x,y,z)). |
D(i) | select(i, Dx, Dy, Dz). |
N(i) | select(i, Nx, Ny, Nz). |
P(i) | select(i, Px, Py, Pz). |
bound(a, x, b) | Limit x to range between a and b. |
Acos(a) | More robust version of the builtin acos. Limits the argument to [-1 ... 1] |
Asin(a) | More robust version of the builtin asin. Limits the argument to [-1 ... 1] |
Atan2(a, b) | More robust version of the builtin atan2. Checks the arguments for zero values. |
Exp(a) | More robust version of the builtin exp. Returns 0 for too high values of a. |
Sqrt(a) | More robust version of the builtin sqrt. Returns 0 for negative values of a. |
and(a, b) | Returns b if a is greater than zero, else a. |
or(a, b) | Returns a if a is greater than zero, else b. |
not(a) | Returns -1 if a is greater than zero, else 1. |
abs(a) | Returns absolute value of a. |
sgn() | Returns 1 if a is positive, -1 if it is negative, else zero. |
sq(a) | Returns the square of a. |
max(a, b) | Returns the larger value of a and b. |
min(a, b) | Returns the smaller value of a and b. |
inside(a, x, b) | Returns a positive value if x is greater or equal than a and smaller or equal than b, else a negative value. |
fraq(a) | Returns the fractional value of a. |
mod(n, d) | Returns n modulo d. |
tri(n, d) | Folding modulo function. Every other successive
range is assumed to have reverse orientation.
...[-2n, -1n], [0, n], [2n, 3n]... are mapped to [0, n]. ...(-n, 0), (n, 2n), (3n, 4n)... are mapped to (n, 0). |
linterp(t, a, b) | linear interpolation between a and b. t must be between 0.0 and 1.0. |
noop(a) | Returns a. |
clip(a) | Return value bounded between 0 and 1. |
noneg(a) | Restricts a to values equal or greater than zero. |
red(r, g, b) | Returns r, if greater than zero, or zero. |
green(r, g, b) | Returns g, if greater than zero, or zero. |
blue(r, g, b) | Returns b, if greater than zero, or zero. |
grey(r, g, b) | Returns the weighted average of the color values [r g b]. |
clip_r(r, g, b) | Returns r, restricted to the inclusive range 0 to 1. |
clip_g(r, g, b) | Returns g, restricted to the inclusive range 0 to 1. |
clip_b(r, g, b) | Returns b, restricted to the inclusive range 0 to 1. |
clipgrey(r, g, b) | Returns the weighted average of the color values [r g b], restricted to the inclusive range 0 to 1. |
dot(v1, v2) | Returns the dot product of the vectors v1 and v2. The vectors are references to functions of one argument, that select the coordinates of each vector by indexing with that argument (the global function D(i) is an example). |
cross(i, v1, v2) | Returns the coordinate from the cross product of the
vectors v1 and v2 indexed by i. The vectors are references to functions of one argument, that select the coordinates of each vector by indexing with that argument (the global function D(i) is an example). |
fade(n, f, d) | Blends from n to f depending on d. The function uses an exponential curve, where d > 1 results in values closer to f. |
bezier(p1, p2, p3, p4, t) | Bezier interpolation for point coordinates. |
bspline(pp, p0, p1, pn, t) | Spline interpolation for point coordinates. |
turbulence(x, y, z, s) | Recursive version of the perlin noise function noise3. |
turbulencex(x, y, z, s) | Recursive version of the perlin noise function noise3x. |
turbulencey(x, y, z, s) | Recursive version of the perlin noise function noise3y. |
turbulencez(x, y, z, s) | Recursive version of the perlin noise function noise3z. |
uniform2norm(a) | Normal distribution for a value of the uniform range (0,1). |
nrand(x) | Normal distribution of a pesudo random value based on the seed x. |
Global Variables |
|
AC | Synonym for arg(0), available for backward compatibility. |
A1 | Synonym for arg(1), available for backward compatibility. |
A2 | Synonym for arg(2), available for backward compatibility. |
A3 | Synonym for arg(3), available for backward compatibility. |
A4 | Synonym for arg(4), available for backward compatibility. |
A5 | Synonym for arg(5), available for backward compatibility. |
A6 | Synonym for arg(6), available for backward compatibility. |
A7 | Synonym for arg(7), available for backward compatibility. |
A8 | Synonym for arg(8), available for backward compatibility. |
A9 | Synonym for arg(9), available for backward compatibility. |
A10 | Synonym for arg(10), available for backward compatibility. |
U | Local U coordinate for planar surfaces. |
V | Local V coordinate for planar surfaces. |
PI | 3.14159265358979323846 |
DEGREE | PI / 180.0 |
FTINY | 1e-7 |
Up: |
User Manual Overview The Simulation Control Center Project Variation Settings Modifier Types | |
Previous: |
Project Variation Settings | |
Next:
|
Pattern Types |