Text

 


Objectives:  In this lab, you will learn:

-How to load, store, and display polygonal models in the OBJ file format

-OpenGL lighting and shading 



1. (5 pts) Extend your program from lab2 to load and display polygonal models in the OBJ file format. The OBJ file format was first developed for a package called The Advanced Visualizer (TAV) and then later adopted by many other applications. The essential information of the file includes vertex positions, vertex normals, vertex texture coordinates (don’t worry about this now), and faces. Information about the file format can be found on many web site. For example, this wiki page  (http://en.wikipedia.org/wiki/Wavefront_.obj_file) explains the OBJ format. For this lab, you can either choose to:

a)Write your own parser to handle OBJ files. You do not need to handle all OBJ features. For this lab, you only need to load vertex positions, vertex normals, and optionally the material properties of the vertices. You can ignore the rest.

b)Incorporate some open source OBJ loader into your program

In your readme file, be sure to explain which option you take and acknowledge the source of the reader if it is not written by you.

Our grader has prepared a page to help you write a simple OBJ file parser. You can find it from this link..

2. (1 pt) In addition to the OBJ model (s), add additional objects (such as using glut cubes, spheres, or quadric objects) to create an environment like you did for your lab2.

3. (6 pts) Add OpenGL illumination to display your objects. To do this, all vertices need to have their normals defined. Also, you need to make sure the normals are all unit vectors (you can use glEnable(GL_NORMALIZE() for this).  Add at least two light sources to the scene:  The first is an OpenGL point light, and the second is a spot light. The point light should be placed at a fixed location in the world. The spot light will be at the top of a main object of your choice and pointing downwards. Press ‘1’ and ‘2’ to toggle your point light and spot light. Choose appropriate material properties for your objects in the scene. Use a key '+' to increase the shininess of all the objects and '-' to decrease the shininess.  Add key 's' to toggle between flat shading and smooth shading.

6. (3 pt) Control the movement of one main object in the scene using keys:  press the keys 'l' and 'r' to turn left and right, and  keys 'f' and 'b' to move forward and backward. This allows you to steer your object to move around in the environment.

Bonus Point (2 pt) Set the camera so that the scene will be seen from your main object’s point of view wherever it goes (like what you see in those first person shooting games).  Use the key ‘c’ to toggle this.


Submitting Files

What to submit? 

Your program source files

The Visual Studio solution and project files you use to compile your program.

A simple readme file if you have any instructions about how to compile and use your program.


Do not submit any executable or object files.

In order to submit files for cse581  lab3, use the following command:

submit c581aa lab3 < names of all your files>


Important Note about the 'submit' program

The 'submit' program submits all of the files at once,  not  one at a time, previous submissions for a given lab are completely removed.  Or put another way; each time the  submit command is issued for a given lab, ALL of the previously submitted files are clobbered.

That means that

          submit c581aa lab3 lab3.c
          submit c581aa lab3 readme

will result in ONLY 'readme' remaining in the lab1 submission

You should do the following:

          submit c581aa lab3 lab3.c readme
          or
          submit c581aa lab3 lab3_dir

Where 'lab3_dir' is a directory containing all of  the  lab1 files to be submitted, or best of all (for both student and grader) is:

          cd lab3_dir
          submit c581aa lab3 .

Submit will immediately print submission information to  the submitter. Use 'man submit' if you have any other questions.




Late Penalty

You should submit your lab on time. We are on a quarter schedule, which is pretty tight. Being late for one lab could affect the time left for you to complete subsequent labs. All labs are due at 11:59pm of the specified due data, and there is a 10% penalty each day for up to 50%. After that, you get zero.




Grading Criteria

Grading of the labs will be based on the following:

90%: Correctness and adherence to assignment specification.

10%: Readability, structure of code, use of comments, adherence to lab procedures (submitting, naming conventions, etc.)

The grader will grade the labs. If you have problems with the grade you received on your lab, see the grader first. If you can't resolve the dispute with the grader, then see me. However, in order to maintain consistent grading for everyone in the class, I am not very inclined to alter grades that are assigned by the grader.

Don't copy labs. Discussion of lab assignments is allowed and encouraged. However, you need to complete the lab all by yourself. Labs which are too similar will be handed over to the Committee on Academic Misconduct and handled by them.
 



 

CSE 581 Lab 3

Due: 2/23/2011 11:59 pm