CSE 581 Lab3 (13
points)
Due:
Objectives: You are expected to learn:
- Camera control
- OpenGL lighting and shading
1. (1 pt) Enhance your scene from lab2: (a) whenever possible,
change cubes to cylinders since cubes won’t look as good under lighting.
(b) create an environment surrounding your main objects such as a floor, walls,
and some decorating objects if you did not have those already in your lab2 (such
as furniture, etc). Your floor should be
made of an array of GL_QUADS or GL_QUAD_STRIP at a resolution of your choice
(for example, 20x20)
2. (2 pt) Allow the user to control the movement of your main object using keys: press the keys 'l' and 'r' to turn left and right, and keys 'f' and 'b' to move forward and backward. This way, you will be able to control the position of your object continuously. I will explain what this means in class.
3. (3 pt) Control your camera. Use left and right arrows to move your camera’s center of interest (COI) to the left and right, up and down arrow keys to move the COI up and down, ‘y’ to spin your camera counter-clockwise, ‘L’ and ‘R’ to move the camera position horizontally (but not changing the COI), and ‘U’ and ‘D’ to move the camera vertically. Use key ‘h’ to rest the camera to its original direction/orientation.
4. (4 pts) Add at least three lights to the scene: The first is an OpenGL point light, the second is a spot light, and the third is a headlight. The point light should be placed at a fixed location in the world. The spot light will be at the top of your main object and pointing downwards. It should also follow the main object all the time as it moves. The headlight should be placed at the camera position and points straight into the scene. Press '1', '2', and '3' to toggle each of the lights on and off. Make sure that the effect of lighting from each light source can be seen clearly.
5. (1 pt) Choose
appropriate material properties for the object in the scene. Use a key '+' to
increase the shininess of all the objects in your scene and '-' to decrease the
shininess.
6. (1 pt) Add key 's' to toggle between flat
shading and smooth shading.
7. (1 pt) Add the light distance attenuation effect to the scene. Play
with the parameters so that the effect can be clearly seen. Read the
description in the red book pp. 187-188. Use key ‘e’ to turn on and
off this effect.
Bonus Point (2pt) Set the camera so that the scene will be seen from your main object’s point of view wherever it goes (like what you will see in those first person shooting games).
Bonus Point (1pt) Allow animating the camera automatically along some predefined path when the user presses a key.
More about submitting your lab. The following is a message prepared by out grader.
Hi class,
I would
like to give some suggestions for the lab submission. The submissions for lab1
brought me a lot of trouble to set up the environment (solution and project) to
compile the labs. I feel you may need a more detailed instruction for
submission.
Dr. Shen said that "the source files, the Visual studio
solution file and readme should be submitted". I
think "the Visual studio solution file" doesn't mean the single .sln file, it means all the related files which will be
needed for direct compilation in Visual studio, for example the project file (.vcproj). If you just provide the .sln
file, I will be unable to compile it directly, and the .sln
is useless. You may try it yourself.
My
suggestion is:
Before you
submit your lab, do the following steps:
step 1. in MS Visual Studio, clean the solution by
clicking "Build -> Clean Solution (for the Visual studio verion 7.0 or 7.1 or 8)". For the Visual studion 6.0, I think it might be "Clean Project".
By doing it some large files such as ".obj"
will be deleted, they are just intermediate files during compilation and are
unnecessary to submit.
step 2. copy all the files
which you want to submit to a new folder, say "labX_submit"
step 3. enter the new folder "labX_submit",
click the ".sln (for version 7.x or 8.x)"
or "dsw (for version 6.x)". Make sure you
are able to open the projet, compile and run it.
step 4. do exactly the same
as in step 1.
step 5. (I assume you are exactly in the new folder
"labX_submit"), use the command
"submit c581aa lab2 *". * means all the files in
the folder.
From now
on, if your submission is unable to compile and run directly, 1 point will taken from this lab's points.
And if you
did something which will earn bonus for you, please meansion
it in the README as the first paragraph. It is one of the most important things
in the README, right?
Thanks a
lot for your cooperation.
- Ying