RenderMan Shading Language
Renderman Shading Language (abbreviated RSL) is a component of the RenderMan Interface Specification, and is used to define shaders. The language syntax is C-like.
A shader written in RSL can be used without changes on any RenderMan-compliant renderer, such as Pixar's PhotoRealistic RenderMan, DNA Research's 3Delight, Sitexgraphics' Air 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 such as 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). Shaders have no return values, but functions can be defined which take arguments and return a value. For example, the following function computes vector length using the dot product operator ".":
float length(vector v) {
return sqrt(v . v); /* . is a dot product */
}
Further reading
- Steve Upstill: The RenderMan Companion: A Programmer's Guide to Realistic Computer Graphics, Addison-Wesley, ISBN 0-201-50868-0
- Anthony A. Apodaca, Larry Gritz: Advanced RenderMan: Creating CGI for Motion Pictures, Morgan Kaufmann Publishers, ISBN 1-55860-618-1
- Ian Stephenson: Essential RenderMan Fast, Springer, ISBN 1-85233-608-0
- Saty Raghavachary: Rendering for Beginners: Image synthesis using RenderMan, Focal Press, ISBN 0-240-51935-3
- Rudy Cortes and Saty Raghavachary: The RenderMan Shading Language Guide, Course Technology PTR, 1 edition (December 27, 2007), ISBN 1-59863-286-8
RenderMan knowledge
- CG References & Tutorials by Prof. Malcolm Kesson
- RenderMan Notes (notes on shader writing)
- RenderMan Shader Language by Dominik Susmel