CMSC 435/634: Introduction to Computer Graphics

Assignment 8
Due December 9, 2002

The Assignment

For this assignment, you must implement a procedural shading/texturing mechanism to augment your earlier assignments. You may choose to implement your procedural shading for either your ray-tracer or BMRT. You should be able to create an image of an object textured with at least one procedural texture. Ten percent of the grade will be awarded for particularly realistic or original textures.

Adding Procedural Shading to a Ray Tracer

The most straight-forward way to add procedural shading/texturing to your ray tracer is to write a procedure that will be evaluated at each sample point which takes the 3D position as an argument and returns an object color at that sample point. This essentially implements a 3D texture. Adding this to the rendering of a sphere, for instance, will create an image of a sphere carved out of some solid, textured substance. Some 3D textures that you might want to try to produce include:

For textures with a random component, you can find a C version of Ken Perlin's code for his new noise function in ~olano/public/435/assn8.

Writing a RenderMan Shader

Alternatively, you may choose to implement a procedural shader using the RenderMan shading language. There is a section on compiling shaders in the BMRT User's Guide that you have. A variety of sample shaders can be found in the BMRT/shaders directory. Some good ones to look at are and which correspond to familiar illumination models. A good guide for writing shaders can also be found online in Steve May's RMan Notes ( If you use any of these as a starting place for your shader, please cite what sources you've used. Once you have created and compiled a new shader, you can create objects of that substance using the RiSurface() call to set the global state.

Feel free to reuse code you've developed in earlier assignments.

Extra credit

For up to 10 points of extra credit, also implement a more interesting lighting model in your shader. If you are adding shading to your ray tracer, you will want to also pass the surface normal and ray/view direction to your shading proceedure. These additional parameters are already available in RenderMan shaders, so you'll just need to use them.

What to turn in

Turn in this assignment electronically as 'cs435 Proj8' (or after the due date as Proj8late) using the submit mechanism:

    submit cs435 Proj8 [files...]

In addition to the usual requirement that you turn in all files that you created or modified (everything we'll need to run your project), also turn in a short text file telling us what you've done. I'm not looking for a wordy write-up here, just the facts: ray tracer or BMRT? What shading effects did you produce? If you did the extra credit, what lighting model did you implement? Please include instructions on how to build (if more than just typing make) and run your project!