appendixA.html, appendixF.html, index.html, section01.html, section02.html, section03.html, section04.html, section05.html, section06.html, section07.html, section08.html, section09.html, section10.html, section11.html, section12.html, section13.html, section14.html, section15.html, section16.html
Mathematical Functions | Geometric Functions | Color Functions | Shading and Lighting Functions | Texture Mapping Functions | Volume Variable Access Functions | Print Functions
float PI = 3.14159...
float radians(float degrees)
float degrees(float radians)
float sin(float a)
float asin(float a)
float cos(float a)
float acos(float a)
float tan(float a)
float atan(float yoverx)
float atan(float y, float x)
OK.
float pow(float x,y)
float exp(float x)
float sqrt(float x)
float log(float x)
float log(float x, base)
OK.
float mod(float a,b)
float abs(float x)
float sign(float x)
OK.
float min(float a,b)
float max(float a,b)
float clamp(float a,b)
OK.
color min(color a,b)
color max(color a,b)
color clamp(color a,b)
point min(point a,b)
point max(point a,b)
point clamp(point a,b)
The componentwise point and color variants of min, max and clamp are a supported language extension.
float floor(float x)
float ceil(float x)
float round(float x)
OK.
float step(float min, value)
float smoothstep(float min, max, value)
OK.
float spline(float value; float f1,f2,..,fn,fn1)
color spline(float value; color c1,c2,..,cn,cn1)
point spline(float value; point p1,p2,..,pn,pn1)
OK.
float Du(float p)
float Dv(float p)
float Deriv(float num; float den)
color Du(color p)
color Dv(color p)
color Deriv(color num; float den)
point Du(point p)
point Dv(point p)
point Deriv(point num; float den)
The above functions may not be used inside user-defined functions.
float random()
color random()
point random()
OK.
float noise(float v)
float noise(float u, v)
float noise(point pt)
color noise(float v)
color noise(float u, v)
color noise(point pt)
point noise(float v)
point noise(float u, v)
point noise(point pt)
OK.
float noise(point pt, float t)
color noise(point pt, float t)
point noise(point pt, float t)
These four-dimensional versions of noise are a supported extension to the language.
float cellnoise(float v)
float cellnoise(float u, v)
float cellnoise(point pt)
color cellnoise(float v)
color cellnoise(float u, v)
color cellnoise(point pt)
point cellnoise(float v)
point cellnoise(float u, v)
point cellnoise(point pt)
float cellnoise(point pt, float t)
color cellnoise(point pt, float t)
point cellnoise(point pt, float t)
Cellnoise is a supported extension to the language.
float xcomp(point P)
float ycomp(point P)
float zcomp(point P)
setxcomp(point P; float x)
setycomp(point P; float y)
setzcomp(point P; float z)
OK.
float length(point V)
float distance(point P1,P2)
float area(point P)
point normalize(point V)
point faceforward(point N,I)
point faceforward(point N,I, Nref)
area() may not be used inside functions.
point reflect(point I,N)
point refract(point I,N; float eta)
float fresnel(point I,N; float eta, Kr, Kt)
float fresnel(point I,N; float eta, Kr, Kt; point R, T)
OK.
point transform(string fromspace, tospace; point P)
point transform(string tospace; point P)
Note that transform() will always perform a point transform, even when used on vectors or normals. To transform vectors and normals use the vtransform and ntransform functions below.
point vtransform(string fromspace, tospace; point V)
point vtransform(string tospace; point V)
point ntransform(string fromspace, tospace; point N)
point ntransform(string tospace; point N)
These are supported extensions. vtransform() transforms vectors and ntransform() transforms normals.
The strings which specify tospace, and fromspace must be constant strings (i.e. not string parameters).
point transform(string fromspace; matrix m; point P)
point transform(matrix m; point P)
point vtransform(string fromspace; matrix m; point V)
point vtransform(matrix m; point V)
point ntransform(string fromspace; matrix m; point N)
point ntransform(matrix m; point N)
The transform calls may be used with matrices. This is a supported extension.
float depth(point P)
float calculatenormal(point P)
calculatenormal() may not be used inside functions.
float comp(color c; float index)
float setcomp(color c; float index)
color mix(color c0, c1; float value)
OK.
color ambient()
OK.
color diffuse(point N)
color specular(point N, V; float roughness)
color phong(point N, V; float size)
color trace(point P, R)
The return values of these functions are not available directly in shaders. They must only be used to accumulate a multiple of their result directly into Ci. (See: Surface Shaders.)
float isshadowray()
returns 1.0 if we are in a shadow ray pass and 0.0 otherwise. This is a supported extension to the language.
float raylevel()
returns the depth of the ray segment in the ray-tracing hierarchy. This is 0 for eye-rays, 1 for secondary rays, etc. This is a supported extension to the language
Texture calls that use derivatives implicitly may not be used inside function calls. I.e. only the 8 co-ordinate versions of the texture mapping functions can be used inside functions.
Specifying a channel other than 0 is only supported for float versions of the texture calls. Only the first four channels of a texture may be accessed.
The only Texture Access Parameters that are supported are "fidelity" and "samples".
float texture(string name[channel];[texture coords,][parameterlist])
color texture(string name[channel];[texture coords,][parameterlist])
May not be used inside functions.
float environment(string name[channel];[texture coords,][parameterlist])
color environment(string name[channel];[texture coords,][parameterlist])
May not be used inside functions.
point bump(string name[channel];point N, dPds, dPdt;
[texture coords,][parameterlist])
Bump mapping using this function is not supported. This function returns the point 0.
May not be used inside functions.
float shadow(string name[channel];[texture coords,][parameterlist])
Shadow mapping using this function is not supported. This function returns 0.
May not be used inside functions.
float incident(string name; float value)
float incident(string name; color value)
float incident(string name; point value)
float opposite(string name; float value)
float opposite(string name; color value)
float opposite(string name; point value)
These functions are not supported.
printf(string format; val1, val2,.., valn)
The format string must be an explicit string constant.
Last modified: Fri Apr 11 16:25:42 BST 2003