Assignment 1: Shading

CMSC 635, Spring 2007

Due March 8, 2007


Create an interactive program using either OpenGL or Direct3D using the computer, OS and language of your choice. Your program should render to a buffer object, then use the result as a texture to achieve some non-local effect as described in a published paper. Your paper can either describe a real-time effect, or a non-real-time effect adapted to real-time for your assignment. Some possible examples:

You can use sample code to get you started, and are free to use external libraries or code not directly related to your method, but the pass control and shading code should be your own. Essentially, you should write code the original author would have had to write, but may use external sources equivalent to those they could have used. Your models can be simple geometric objects or imported from external sources (in which case, I strongly encourage you to adapt an existing model loader). You can use additional textures, either generated, painted, or captured, if you need them. Be sure to document all external resources in your readme.txt.

Since I may not be able to run your program directly, you should capture a short video of your program in action. Assignment results will be shown in class.

What to turn in

You will submit your work using cvs. Check in a readme.txt file telling me what external sources you used, what you did for your assignment, and what I should notice. Check in all of your source code files, and anything else that cannot be regenerated from them, including any external textures or models. Finally, check in your short captured video. If you use any special installed packges, document where they came from and which version, but do not include them in your submission. Do not include any compiled object files, libraries or executables. They won't do me any good, and can lead to strange hard to find bugs when compiled code not corresponding to your current source is resurrected from the repository.

If you need your quota increased, let me know.

External help

I am expecting you will need make heavy use of external resources: papers, web resources, sample code, and your classmates. If it is something the original author could have had access to if writing the paper today, feel free to use it, but document it! In addition, you can (of course) use the paper describing your method, but author-provided program or shading source code is off-limits, whether in the paper, on a conference CD/DVD, or online.


You will most likely run out of time. Plan accordingly, both to start early and to have something working by the deadline. Unless you already have a working setup, it will take more time than you think to get any necessary support libraries to work on your machine, get shaders and buffer objects to work, and get appropriate capture software running.

I'd work on getting a simple shader working first, then buffer objects in a simple setup, before even thinking about the non-local effect aspect.

You have to make extra calls to get your errors, but the debugging value is well worth it. Also worth it is including some way to reload shaders without restarting the program (file watching, key press, etc.)

Debugging shaders is an art. One handy trick is to copy non-color values into the output color (possibly with a scale and bias) to "see" how they change across the objects or screen. In addition, you can read individual pixel values (especially from a float buffer) to get a more precise idea of what is going on.

When you choose your non-local effect, consider the quality of the results, the ease of implementation, and the amount of time remaining when you get to that point. Also, consider the limitations of your particular graphics hardware. You can do this assignment with 3-4 year old hardware with severe instruction and texture lookup restrictions, but only if you don't choose a method that exceeds those limits.