CS348b Final Project

Gary King (gking@cs.stanford.edu)

The big technique I implemented for my final project was a programmable shading language capable of emulating (if not outright supporting) many of the shaders that can be created in Renderman's shading language. It uses an assembly language syntax similar to the DirectX pixel shading language, and bares a lot of similarity to SIMD processors.

My language supports branching, randomness (through both the ANSI rand() operator and Ken Perlin's pseudo-random noise code), vector and scalar arithmetic, dependent texture accesses, exponentiation, and additional elementary operations.

Some of the additional features I implemented in order to better support my shading language were texture mapping, bump mapping, and cubic environment mapping. Currently, the advanced parameters are not supported for these features (e.g., selectable filters, clamping, etc.) -- all values are returned after being passed through 2x2 box filters.

I am still working on a final image for the 348b web page; however, the following images were all generated using shaders written in my shading language, to demonstrate its capabilities (click on the links for the shader source code):

Simplified cel shader on a robot leg

Another shot of the cel shader

Glass shader, supporting reflection, and refraction.

Bump mapping a textured polygon.

A port of the procedural wood2.sl shader that ships with BMRT

The source code for my project is available here.
LRT can be compiled by running gmake on a Linux machine.
The shading compiler (slc) can be compiled by running gmake slc on a Linux machine.
A reference for my shading language is available here.
My original project proposal is on-line here.
The RIB source for the robot leg can be downloaded here. It is being modeled in 3DSMax.
The RIB source for the procedural wood demo can be downloaded here.