Because rib files are used to convey information from a modeler to a renderer, RenderMan implicitly stresses an important distinction between, what is referred to in the Pixar literature, as
For example, figure 1, despite its appearance, consists only of two closely spaced square polygons that been been transformed by the "shading" techniques of displacement, texture, specular and transparency mapping.
Clearly, shaders play a crucial creative role in defining the appearance
of CG a production. RenderMan has been adopted
by many leading studios because it allows special purpose shaders
to be added to those that already exist.
While shaders are generally independent of each other ie. any surface
shader may be used with any displacement shader, each type of shader has
a specific role in the rendering process. Therefore, a surface shader such as
plastic cannot be used as a displacement shader.
Shaders calculate specific values at more or less regular intervals
across the surfaces being shaded by a renderer. A RenderMan complient
renderer sub-divides each object in a 3D scene into a fine mesh
Shading Language Variables
Data going "into" a shader, as well as the values calculated by a shader are stored in memory locations that hold, what is referred to, as variables. Each time a shader is called ie. used by the renderer, it gets data from,
Shaders use global variables to read data from
the renderer (shader input), for example, the color of a surface.
Shading Language Data Types
The Shading Language uses the following data types:
Notice that integers are not supported by the language, therefore, all single values must be declared as a float. Also local variables cannot use the string data type.
Writing and Compiling a Shading Language File
Writing a shader in the Shading Language is similiar to writing an application in the 'C' language. Like a 'C' language source file (.c), code in the Shading Language is written with a text editor, but named with a .sl file extension. The easiest way to write a shader is to use the Cutter text editor because it has the following facilities.
Successful compilation produces a shading language object file ie. a shader. The
extension of the shader file will vary from one RenderMan complient system to
another. For example, Pixar's system uses ".slo" as the file extension for
shaders compiled with their "shader" compiler. The name of the shader file will match the name of the shader
defined by the code rather than the name of the .sl file. When using Cutter,
shader files will be saved to a "shaders" directory specified by the user
in Cutter's preferences.
(prompt%) shader test.sl
A Basic Rib File For Testing a Shader
Once a shader has successfully compiled you will want to test it. This can
be accomplished using Maya (plus a Pixar's mtor or Rfm plugin) or Houdini
(does not require a plugin). Alternatively, a sample rib file might be edited
so that it uses your new shader. Again, Cutter speeds up development
by generating and rendering either single frame or multiple frame rib files.
When this rib file is rendered via Cutter a dialog box will prompt the user to add three Options to the beginning of the document. The Options will be automatically added to the users rib file. For example,
Option "searchpath" "texture" "../../textures" Option "searchpath" "shader" "@:../../shaders" Option "searchpath" "archive" "../archives:Cutter_Help/templates/Rib:custom_templates/Rib"
© 2002- Malcolm Kesson. All rights reserved.