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

  • Upstill, Steve (1990). The RenderMan companion : a programmer's guide to realistic computer graphics. Reading, Mass: Addison-Wesley. ISBN 0-201-50868-0.
  • Apodaca, Anthony; Gritz, Larry (1999). Advanced RenderMan : creating CGI for motion pictures. San Francisco: Morgan Kaufmann. ISBN 1-55860-618-1.
  • Cortes, Rudy; Raghavachary, Saty (2008). The RenderMan shading language guide. Boston, Mass: Thomson Course Technology. ISBN 1-59863-286-8.
gollark: Wait, can't a lot of "alive" stuff only replicate if it has a suitable environment, too?
gollark: Also, it would consider sterile humans not alive.
gollark: The "and another member of your species" bit does have the interesting implication that you can't really call something alive or not if you just have one of it, then.
gollark: That is true, except I think some cells can't because of DNA damage or something.
gollark: I mean, individual animals can't reproduce on their own, except the weird ones which can.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.