CMSC 435/634: Introduction to Computer Graphics

Assignment 5
Shading
(aka Still Life, with Vegetables)
Due November 21, 2012

The Assignment

Use the Pixie RenderMan renderer to model and render a still life with a bowl of vegetables on a table (refer back to assignment 1 for instructions on using Pixie). At least the bowl and veggies, 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 surface, bowl and one type of vegetable.

Model your vegetables with the standard RenderMan primitives, using displacement shaders for fine sculpting of the shape. For example, you might create a cucumber from a cylinder and a couple of spheres, with displacement to used to bend the shape a little and add the cucumber's surface bumps. A tomato could be modeled as a single sphere, using displacement to shape the top where the stem attaches. 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. If you are a 435 students, you do not have to write your own light shaders, the standard lights are fine.

Simple sample code is provided in your CVS directory with a displacement and surface shader. The provided code is C++, but you are welcome to use either C or C++.

634 only

Also include at least one light using your own light shader.

Extra Credit

For 5 points each, add up to three additional types of vegetables (for a total of up to four and up to 15 extra credit points). Variations of similar appearing vegetables will not count. So both zucchini and yellow squash, or both red tomatoes and green tomatoes would not count for the extra credit, but a zucchini and butternut squash 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 vegetables, or at least images of the vegetables you are trying to model. You'll do best if you treat this assignment like you are trying to create a caricature of the vegetable: 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, and more suggestions for shader development strategies on Steve May's RMan Notes page.

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, mapping an x/y/z vector to red/green/blue. Keep in mind that colors are clamped to [0,1], so when mapping to color all values less than 0 will look the same as 0, and all values greater than 1 will look the same as 1. I also often use something like this for float values: color(-sign(d),sign(d),abs(d)). This will be black only if d is exactly 0, red to magenta if it is negative, and green to cyan if it is positive.
  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.

What to turn in

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. As always, double check that you have submitted everything we need to build and run your submission, but not any generated files.

Also, include a readme.txt file telling us about your assignment. Do not forget to tell us what (if any) help you received from books, web sites or people other than the instructor and TA, details about how you implemented the extra credit (if attempted).

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.