26.01.2015 Views

The RenderMan Interface - Paul Bourke

The RenderMan Interface - Paul Bourke

The RenderMan Interface - Paul Bourke

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>The</strong>se functions compute power and inverse power functions. pow returns x y , exp<br />

returns e x . sqrt returns the positive square root of x, and inversesqrt(x) returns<br />

1/sqrt(x). log with one argument returns the natural logarithm of x (x = log(exp(x))).<br />

log with two arguments returns the logarithm in the specified base (x = log(pow(base,<br />

x), base)).<br />

float mod ( float a, b )<br />

float abs ( float x )<br />

float sign ( float x )<br />

mod returns a value greater than 0 and less than or equal to b such that mod(a,b)<br />

= a - n*b for some integer n. abs returns the absolute value of its argument and sign<br />

returns -1 if its argument is negative, 1 if its argument is positive, and 0 if its argument<br />

is zero.<br />

type min (type a, b, ... )<br />

type max ( type a, b, ... )<br />

type clamp ( type a, min, max )<br />

min takes a list of two or more arguments of identical type and returns the argument<br />

with minimum value; max returns the argument with maximum value. clamp(a,min,max)<br />

returns min if a is less than min, max if a is greater than max; otherwise it returns a.<br />

<strong>The</strong> type may be any of float, point, vector, normal, or color. <strong>The</strong> variants that operate<br />

on colors or point-like objects operate on a component-by-component basis (e.g.,<br />

separately for x, y, and z).<br />

float mix (float x, y; float alpha )<br />

point mix (point x, y; float alpha )<br />

vector mix (vector x, y; float alpha )<br />

normal mix (normal x, y; float alpha )<br />

color mix (color x, y; float alpha )<br />

mix returns x · (1 − α) + y · α, that is, it performs a linear blend between values x<br />

and y. <strong>The</strong> types of x and y must be identical, but may be any of float, point, vector,<br />

normal, or color. <strong>The</strong> variants that operate on colors or point-like objects operate on<br />

a component-by-component basis (e.g., separately for x, y, and z).<br />

float floor ( float x )<br />

float ceil ( float x )<br />

float round ( float x )<br />

floor returns the largest integer (expressed as a float) not greater than x. ceil returns<br />

the smallest integer (expressed as a float) not smaller than x. round returns the integer<br />

closest to x.<br />

float step ( float min, value )<br />

float smoothstep ( float min, max, value )<br />

134

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!