My final graphics project started out as a visualizer. I started with bouncing balls in an eclosed space. I implemented a basic collision detection system. The balls bounce off the walls, floor, ceiling, and each other. Afterwords I worked on getting GLSL working with my program. Creating the shaders in GLSL involved computing, with the Phong Model, the lighting for every pixel.
For the diffuse shader only the diffuse light is taken into account. This involves computing the position of the vertex that the diffuse light is being calculated for. Then using the vertex position and the normal vector the light vector is computed. The diffuse lighting is just the maximum of the dot product of the light vector and the normal vector and 0.
The spectral shader just adds on the the diffuse shader already created. For specular lighting the eye position is computed along with the view and reflected light vectors. The specular lighting is just the maximum of the dot product of the view and reflected vectors raised to the shininess coefficient power and 0.
Future work will include getting multiple materials to work with the shaders to make them more realistic.