Part 4: Adding Materials

Performance Template

Required Image

Here is the required image:

Image #4A

Creative Image

Here is the creative image:

Image #4B

The creative image contains a pair of red spheres shaded with the Phong material, a pair of green spheres shaded with the metal material and a pair of dielectrics. The dielectrics have a lightly blue shade due to absorption according to Beer's law. The top one is hollow with an air bubble 0.4 times its radius. The bottom on contains another green metal sphere at its core, also 0.4 times its radius. The ground plane has my glossy shader as usual.

Design Choices

I implemented the materials largely as described in the class lecture. The only really interesting parts were related to my implementation of dielectrics:

Extra Credit

Image #4C

I hope this counts for the extra credit. Verbally in class there was mention of toon shading for the extra credit, though I now notice that the assignment sheet is a little different.

I thought it would be fun to try to implement a crosshatch style NPR shader and this is what I cooked up. The shader starts by calculating the standard ambient/diffuse/phong specular combination, plus an optional constant mirror reflection. If below depth 0, this value is simply returned.

At depth 0, however, the luminance of this colour is computed. An adjustment is made to darken it where the normal comes close to perpindicular with the viewing direction: this helps bring out the silhouette better in some cases (note the edges of the spheres and the horizon line). Next, the hit position of the primary ray (since this is depth 0) is transformed back into screen space by multiplying it with the transpose of the camera's screen-to-world matrix (with a slight offset to give the lines a nice small curve). The screen space coordinates are then tested to see if they fall on any of the crosshatch lines. To determine which set of crosshatches to test, the luminance is quantized to one of nine levels. The brightest is left white, the second brightest tested against one set of crosshatch lines, the third against that plus another, etc. Each new set of crosshatches is linearly interpolated in to reduce the discontinuity from the quantization. The sets of crosshatches where chosen to alternate directions and to start sparse and then fill in.

I should also note that a fisheye camera model was used for this image.


Last modified: Tue Feb 15 00:11:29 MST 2005