RenderMan Shading Language

From Wikipedia, the free encyclopedia

Commonly referred RSL, Renderman Shading Language is used to define shaders used in RenderMan. The language syntax is C-like.

Pixar has set a standard in the Shading Language.

The beauty of using a standard language is that a programmed shader can be used in multiple renders, be it PhotoRealistic RenderMan or an open source solution such as Pixie or Aqsis.

RenderMan Shading Language defines standalone functions and five types of shaders: surface, light, volume, imager and displacement shaders.

An example of a surface shader that defines a metal surface is:

 surface metal(float Ka = 1; float Ks = 1; float roughness = 0.1;)
 {
   normal Nf = faceforward(normalize(N), I);
   vector V = - normalize(I);
   Oi = Os;
   Ci = Os * Cs * (Ka * ambient() + Ks * specular(Nf, V, roughness));
 }

Shaders do the work by reading and writing special variables like Cs - surface color, N - normal at given point, and Ci - final surface color. The arguments to the shaders are global parameters that are attached to objects of the model (so one metal shader can be used for different metals and so on), and they have no return values. On the other hand functions operate by taking arguments and returning a value, and make little use of special variables. For example the following function computes vector length looks almost like a Java or C function except for using dot product operator:

 float length(vector v) {
   return sqrt(v . v); /* . is a dot product */
 }