ShadingC: The Shading Compiler

(c) 2000 J. Scott Iverson
Siren supports the Shading Language defined in the Renderman standard.  Shaders must be compiled prior to use using the stand-alone program shadec.  ShadeC is invoked as follows:
ShadeC will produce an object file with the name of the shader and no extension.  ShadeC can take an optional parameter -I followed immediately by a path to be searched for header files #included in the shader.

Siren supports most of the shading language constructions found in the Renderman Standard and most of the extensions added by other renderers.  Supported extensions include vectors, normals, matrices, and arrays.  The following functions are not yet supported:
ptlined format concat
match determinant surface
displacement atmosphere attribute
option textureinfo rendererinfo

There are also important differences and limitations in the way some functions are implemented.  In particular, derivatives are interpreted in a non-standard way.

Derivatives in Siren

Several functions in the Shading Language rely on the ability to take derivatives of arbitrary expressions over a surface element.  The built-in functions Du() and Dv() are supposed to give the change in an expression across a surface element in the u- and v-parametric directions, respectively.  They are also supposed to give the change between shading samples.  Because Siren does not shade along the u- and v-axes, it interprets derivatives differently for efficiency.  Shading for Phong-shaded primitives is performed at pixel-samples, which are distributed equally in screen space.  Du(e) returns the change in e between adjacent pixel-samples in the horizontal direction, and Dv(e) the change between samples vertically.  du and dv are always 1.

For the common use of derivatives to generate feature widths for anti-aliasing, this gives the desired result.  E.g.,


is a good estimate of how much e changes between shading samples.

This implementation of derivatives will obviously cause problems for shaders that expect Du() or Dv() to actually be aligned with their respective parametric axes.  Shaders that rely on the length of du or dv also won't work properly.

An exception is made for dPdu and dPdv, which are always smooth estimates of the change in P along the u- and v-axes respectively.

Last Modified March 31, 2000

For questions or comments regarding this document, email: