README - HOMER CLOCK - GARY LAM - CSE 167

My project was based on a Homer Simpson wall clock. The eyes follow the donut on the second hand. The clock shows the actual system time. It is set in a room with walls made up of Simpsons graphics. My intention of doing this was to try to make it seem a bit more 'artsy.' It's weird enough having a clock floating in the middle of a room, so I tried finding Simpsons graphics that would add to this unique effect. I found that I was rather succesful in meeting my goals. I expected to spend most of my time rendering his oddly shaped head and getting the features of the clock to work, which was true. The rest of my time was spent getting the texture maps onto the wall and trying to get the lighting to look good. So my four stages went as follows: 1) head; 2) light; 2) time; 3) texture map on walls; 4) lighting and misc;

For the second, minute, and hour hands, I include time.h and used the tm struct to find the values of the system's time. In order to get the angle that the hand should be rotated at, I had to write some equations out to tell it how much to move counterclockwise, depending on the time of day it was. I would increment or decrement this value by a certain amount, depending on how the user modified the time. My algorithm takes into account how far into the hour the minute hand is; so if the minute hand is at "30," then the hour hand will be halfway between two numbers.

The head was created mostly of glutSolid objects. I had to write a for-loop to create a shape was for the latter half of the head to neck region. There, I had a cylinder that would narrow as the value of y decreased (from top to bottom). Normals for non glutSolid objects were found using formulas provided in lecture and in the book. I used three tori for the three strands of hair on his head and two tori for the ears. The hair was drawn from point to point in the shape of an M, for Matt Groening. Nose, pupil, mouth, and mouth hole were all drawn with spheres. The collar of Homer's shirt is another torus; and the neck is just a sphere that sits low enough in the "shirt" such that the user cannot see what it leads to.

The clock was created by a torus. It has a glass covering, which isn't quite visible since it's behind a glass casing itself. The back of the clock is created with one circle. Culling was turned off when rendering this circle so that it could be viewable from both sides.

Blending and the painter's algorithm was used when rendering the glass casing. Because the painter's algorithm requires that you render from back to front, the 3-d effects of having a glass case are only visible from certain angles; i.e., when staring from the front, it looks fine, but when staring from the back, it looks 2-d.

Five of the six walls are quads, while the sixth wall, which is the floor, is made up of numerous quads drawn with a for-loop. The texture is tiled across the floor here.

The white spotlight sits above the clock and only illuminates the area below it, nothing else.

New technical aspects featured in this project that were not featured in previous projects include texture maps and transparency, blending, and spotlight.

I would say I met my aims pretty well. I had wanted to implement a nice looking clock that actually tells time and I think I did a pretty good job of it. I had to simplify a bit Homer's shirt collar because it was too difficult to render, and I also had to make Homer 3-D instead of 2-D, as it was in the original photograph of the clock.

COMMANDS

The following are commands on getting around this project:

Arrow keys control viewpoint.
h - Set hour forward by 1
H - Set hour back by 1
m - Set minute forward by 1
M - Set minute back by 1
r - Reset time to local time
l - Toggle lights
w - Toggle wireframe mode