This module provides some of the functionality from the RenderMan Shading Language. Those functions that require an actual rendering context (surfaces, light sources, etc.) are not supported.
Most of the functions can be used just like in the Shading Language. An exception are those functions whose return type is dependant on the context as it is the case with random() or noise(). Here, those functions have to be prepended with the return type, for example float_random() or point_noise() (that is, the cast is part of the name).
Returns the absolute value of its argument. This is just the builtin abs() function.
Returns the arc cosine. This function is imported from the math module.
Returns the arc sine. This function is imported from the math module.
Returns the arc tangent. With one argument math.atan() is called, with two arguments math.atan2() is called.
Returns the largest integer not greater than x. This function is imported from the math module.
Returns min if x < min, max if x > max, otherwise x.
Returns a color value (actually a vec3) whose value is a (pseudo) random function of its arguments. The return value is constant between integer lattice points.
Returns a color value (actually a vec3) whose value is a (pseudo) random function of its arguments.
Returns a color value (actually a vec3) whose value is a periodic (pseudo) random function of its arguments.
Return a color whose componenets are a random number between 0 and 1. The function actually returns a vec3.
Returns the cosine. This function is imported from the math module.
Converts from radians to degrees.
Returns pow(e,x). This function is imported from the math module.
Returns a float value which is a (pseudo) random function of its arguments. The return value is constant between integer lattice points. This function is imported from the noise module.
Returns a float value which is a (pseudo) random function of its arguments. This function is imported from the noise module.
Returns a float value which is a periodic (pseudo) random function of its arguments. This function is imported from the noise module.
Return a random number between 0 and 1. This call is equivalent to random.random().
Returns the smallest integer not smaller than x. This function is imported from the math module.
Returns 1/sqrt(x).
Returns the natural logarithm of x (the same as math.log()) or the logarithm to the specified base.
Returns the argument with maximum value. This is just the builtin max() function.
Returns the argument with minimum value. This is just the builtin min() function.
For t = 0 the value val0 is returned, for t = 1 the value val1 is returned. For values of t between 0 and 1 a linearly interpolated value is returned.
Returns a%b. This is just an equivalent for the %-operator.
Returns a point (as a vec3) whose value is a (pseudo) random function of its arguments. The return value is constant between integer lattice points.
Returns a point (as a vec3) whose value is a (pseudo) random function of its arguments.
Returns a point (as a vec3) whose value is a periodic (pseudo) random function of its arguments.
Return a point (a vec3) whose componenets are a random number between 0 and 1.
Returns x**y. This function is imported from the math module.
Converts from degrees to radians.
Returns -1 with a negative argument, +1 with a positive argument, and 0 if its argument is zero.
Returns the sine. This function is imported from the math module.
Returns 0 if value < min, 1 if value > max, and performs a smooth Hermite interpolation between 0 and 1 in the interval min to max.
Fits a spline to the control points given and returns the value at t which ranges from 0 to 1. At least four control points must always be given.
Returns the square root. This function is imported from the math module.
Returns 0 if x < min, otherwise 1.
Returns the tangent. This function is imported from the math module.
Returns a vector (as a vec3) whose value is a (pseudo) random function of its arguments. The return value is constant between integer lattice points.
Returns a vector (as a vec3) whose value is a (pseudo) random function of its arguments.
Returns a vector (as a vec3) whose value is a periodic (pseudo) random function of its arguments.
Returns the distance between two points. The arguments should be of type vec3.
Flips N so that it faces in the direction opposite to I.
Note
In contrast to the Shading Language Nref is not optional.
Returns the length of a vector. This is equivalent to calling v.length().
Returns a unit vector in the direction of v. This is equivalent to calling v.normalize().
Returns the distance between point q and the line segment p0, p1. The arguments should be of type vec3.
Returns the reflection vector given an incident direction I and a normal vector N. This is equivalent to calling I.reflect(N)().
Returns the transmitted vector given an incident direction I, the normal vector N and the relative index of refraction eta. This is equivalent to calling I.refract(N, eta)().
Return the x component of p. This is equivalent to p.x.
Return the y component of p. This is equivalent to p.y.
Return the z component of p. This is equivalent to p.z.
Set the x component of p. This is equivalent to p.x = x.
Set the y component of p. This is equivalent to p.y = y.
Set the z component of p. This is equivalent to p.z = z.
Get an individual color component. This is equivalent to c[index].
Set an individual color component. This is equivalent to c[index] = value.
Returns a concatenated string.
Returns a formatted string (similar to the C function sprintf()). Any occurance of the character % followed by a letter is replaced by a value. In this implementation it doesn’t matter what letter you are actually using (in the Shading Language it would be %f for floats, %p for points, vectors or normals, %c for colors, %m for matrices and %s for strings).
String pattern matching.
Prints the values of the specified variables. Any occurance of the character % followed by a letter is replaced by a value. In this implementation it doesn’t matter what letter you are actually using (in the Shading Language it would be %f for floats, %p for points, vectors or normals, %c for colors, %m for matrices and %s for strings).
The following functions are not supported by this module: