

There are two types of files that you will be concerned with when compiling and using RenderMan shaders: Shading Language source files and Shading Language object files.
Shading Language source files usually contain a single shader written in the RenderMan Shading Language (SL). By convention, these files have a ".sl" extension. When a source file is compiled, a Shading Language object file is produced. The object files used by PRMan and BMRT differ and are incompatible. This means that to use the same shader on both systems, the shader will have to be compiled twice. The two packages also use different extensions for their object files -- ".slo" and ".slc" for PRMan and BMRT respectively.
| Type | Extension |
|---|---|
| Shading Language source file | .sl |
| Shading Language object file (PRMan) | .slo |
| Shading Language object file (BMRT) | .slc |

Nearly every RIB file (RenderMan input file) specifies a scene containing surfaces with shaders assigned to them. Surface shaders are assigned to surfaces by the "Surface" command which requires the shader name (a string) and optionally a list of shader parameters. Below is a RIB fragment which specifies a unit sphere with the "plastic" shader applied to it.
Surface "plastic" "Kd" [1.0] Sphere 1 -1 1 360
When the renderer parses the RIB file and encounters the "Surface" command, it searches for a corresponding Shading Language object file of the same name (but with the ".slo" or ".slc" extension) in a predefined set of directories. In this case, PRMan would look for a file called "plastic.slo" and BMRT would look for a file called "plastic.slc."
When the shader is found, it is loaded into memory and executed as the scene is rendered. A warning message will be displayed if the renderer cannot find an object file for any of the shaders specified in the scene. The same procedure is used for all shader types including light source, displacement, and volume shaders.

PRMan and BMRT each have their own program for compiling RenderMan shaders. PRMan uses a program called "shader" and BMRT uses a program called "slc" to compile shaders (generate shading language object files). Both programs have the same basic usage (although PRMan's compiler does have more features -- see the man page):
One particularly useful option that both shaders compilers have is the "-I" flag which specifies a directory that contains source files which will be included in shaders via the #include preprocessor directive or implicitly when user functions not contained or explicitly included in the shader are used (the latter applies only to the PRMan compiler).
Also, I recommend using the RenderMan Shading Language mode for Emacs which makes compiling and "hit" testing shaders faster.

RManNotes is Copyright © 1995, 1996 Stephen F. May
Any comments or suggestions appreciated.
Steve May (smay@pixar.com)Last Modified: 5/2/00