Homework 6
Short Description:
Add lights and smooth surfaces to your previous program.
This assignment is worth 50 points.
Goals
When you finish this homework, you should have
- Added surface normals to your objects.
- Added lighting and shading to your scene.
- Generated a surface with normals.
Formal Description
Extend homework 5 in a number of ways.
- Shading and lighting: implement shading and lighting in a fragment shader, you should perform Gouraud or smooth shading. This will distort some figures, but the purpose is to do the shading. You may start from the shader I provided in the notes or from Angel's shader from chapter 5.
- Extend your object to include lighting properties, and to set these properties as they relate to your shader implementation.
- Extend your object to include vertex normals. In an .xoff file,
The format for an .xoff file is:
- A number, either 3 for triangles or 4 for quads in the mesh.
- n the number of vertexes,
- the values of n vertexes
- The values of n vertex normals
- The polygon list as before.
Your object should be able to handle a figure composed completely of either triangles or quads.
- Develop a tool which will take a .off file and produce an .xoff file. Use the method described on page 278 to accomplish this. This should NOT be part of your program.
- Develop a tool which will construct a surface. You should be able to specify the boundaries of the surface, along with the height values at a number of "control" points. Your software should then step across the other points in the surface interpolating the height value. Your program may be interactive, or work from a configuration file, but it should produce an .xoff file.
Discussion
Please add the following keypress controls to your system
- 0 - toggle ambient lighting.
- digits 1 through 9: toggle the associated light on and off. You do not need to implement 9 lights, just two, but if you implement additional lights, control them with the digits.
- w - toggle wireframe and smooth shading.
Further discussion
- You should start in a reasonable position with several objects in view.
- Feel free to use whatever models you wish, but you must provide me with the models so that I can test yous programs.
- Feel free to add additional "cool" features, be sure to document these in your README.
- Your program must use the vertex shader to perform the actual rotation.
- Your program must use a fragment shader to implement lighting. You should allow at least two lights, which can be turned on and off.
Required Files
Your code, a Makefile, and a README file.
Submission
You should email tar file as an attachment to a message to danbennett360@gmail.com.