CMSC 435/634: Introduction to Computer Graphics

Assignment 5

Shading

Due November 23, 2011

The Assignment

Use the Pixie RenderMan renderer to model and render a still life with a bowl of fruit on a table (refer back to assignment 1 for instructions on using Pixie). At least the bowl and fruit, part of the table, and part of a wall should be visible. You do not have to model anything that is not visible, but every visible object should use only surface and/or displacement shaders you create. All shaders should be 100% procedural — no texture! At a minimum, you need one wall, the table, bowl and one type of fruit.

Model your fruit with the standard RenderMan primitives, using displacement shaders for fine sculpting of the shape. For example, you might create a banana from a cylinder, pinched at the ends and bent with displacement. Make your shaders as realistic as you can, given the time available (do not spend infinite time, the point differential from not very good to pretty good is much larger than the point differential from pretty good to amazing).

Your scene should be illuminated by at least two lights. You do not have to write your own light shaders, the standard lights are fine.

Simple sample code is provided with a displacement and surface shader. Do a "cvs update -dA" to get a copy. The provided code is C++, but you are welcome to use either C or C++.

Extra credit

For 10 points each, add up to three additional types of fruit (for a total of up to four and up to 30 extra credit points). Variations of the same kind of fruit will not count. So different types of apples or different types of citrus would not count for the extra credit, but an apple and an orange would. You can only get the extra credit points if you turn your assignment in on time or use your free late.

Strategy

Don't go from memory. Get some actual fruit, or at least images of the fruit you are trying to model. You'll do best if you treat this assignment like you are trying to create a caricature of the fruit: identify the most important and identifiable feature and reproduce that first. Then look for what is next most important, until you are satisfied with the look.

Noise is great for random detail: dirt, splotches, veins, etc. Consider stretching it, summing it together at different scales, and running it through various math functions to change the look. For more structured detail, consider other RenderMan functions applied to position or u and v. You can find a list of all of the functions you can use in RenderMan shaders in the RenderMan specification.

Some debugging tips

  1. You can use printf() in a RenderMan shader, though you will usually want to do it inside an if based on surface position to avoid getting spews of data from every pixel rendered. The RenderMan printf adds some extra format codes: %p for points, %c for colors, and %m for matrices.
  2. You can often tell as much or more by mapping some interesting non-color quantity to the output color. For example, red if negative, green if positive (using sign()), or mapping an x/y/z vector to red/green/blue. Keep in mind that only colors are clamped to [0,1].
  3. It is usually easiest to build your shader in layers, and definitely easier to debug a simple layer than a large complex shader.
  4. When you use displacement, you need to set a displacementbound to tell RenderMan the farthest any point on the surface might move. If you do not, you may see gaps or tears in your displaced surface. The sample code does this. If your displacementbound is too big, so Pixie can't tell if the object will end up in front of your eye or behind it, and you may see messages about "Too many eye splits". If this happens, try a tighter bound on the displacement, or move your camera back so even with maximum possible displacement, the object is clearly in front of you.

Submitting your work

Turn in this assignment electronically by checking your source code into your assn5 CVS directory by 11:59 PM on the day of the deadline. Do your development in the assn5 directory so we can find it, and tag your submitted version with the 'submit' tag. As always, double check that you have submitted everything we need to build and run your submission. Be sure to include a Makefile that will build your project when we run 'make', and a readme.txt file telling us about your assignment, especially what kind(s) of fruit you attempted. Do not forget to tell us what (if any) help did you receive from books, web sites or people other than the instructor and TA.

This assignment is due the day before Thanksgiving, so plan your time accordingly. In particular, do not expect either the professor or TA to be very responsive to email questions during the holiday if you choose to turn the assignment in late.