CSE 781
Lab Assignment #1
Due: Half due January 23 in class, the rest due January 27, 2011 at noon.
Lab overview: Modify the simple application for viewing a 3D model using GLSL shaders.
Objective: Upon finishing this lab, you will understand basic GLSL shaders and how they interact with the OpenGL API. You will also have a greater appreciation for vertex versus fragment lighting. Finally, you will have a baseline application that will be enhanced in future labs during the quarter.
Tasks:
- (80%) Write an application that will take a 3D polygonal model and display the model using materials and GLSL shaders. Download the DemoFramework from the course web site as a starting point. The renderer should contain the following features:
- (15%) Modify the DrawableSphere to use a tesselation of dual pyramids as discussed in class (estimated less than 2 hours).
- (5%) Modify the DrawableCube to use either a vertex array or a vertex buffer object (estimated less than 1 hour).
- (15%) Read in and display OBJ files. You can find some OBJ models in this link. Besides the models, on the web site you will also download normal maps. Use Vertex Arrays or Vertex Buffers for your models (estimated less than 2 hours).
- (10%) Rather than try to calculate normals (which requires searching for adjacency), the normals are provided from a high-res model in an image known as a normal map. Read in the PNG files as texture maps in OpenGL. Provide a Texture class a base interface class, and perhaps a Manager (estimated less than 2 hours).
- (5%) Create a vertex shader that samples the normal map using the provided texture coordinates and uses the result as a normal for your lighting calculations (estimated less than 1 hours).
- (10%) Modify the existing shaders to make them OpenGL 3.3 core compliant (bind and pass in the matrices, etc.) (estimated less than 1.5 hours).
- (10%) Modify the framework to remove all matrix state changes, push / pop, etc. and handle this in the Visitor with the help of an additional class to keep track of this yourself (estimated less than 1.5 hours).
- (10%) Develop at least three additional shaders for: 1) Silloutte shading 2) fragment-based lighting; 3) Two-color hemisphere-based lighting (estimated less than 1 hours).
- (5%) Improve upon and use your backgrounds from Homework #1.
- (7%) Create 2 images show casing your work for the course web site. These images must have a pleasant backdrop and your name on them (use GIMP or photoshop). You will get zero credit for an image with a pure saturated color, black or white background. Points will be docked if your models use a pure saturated color.
- (8%) Write-up a 1-2 page report on your program, including some sample results, how to build and how to run your program. Analyze the difference between vertex lighting and fragment lighting as a function of your mesh resolution.
Key Classes / Implementation Notes (Suggestions - not required)
- Define a few key interfaces (pure abstract base classes) for your system to allow more flexibility as we progress through the quarter. These will separate the usage from the creation:
- IMaterial (or IEffect) - Enable and Disable (or MakeActive and Deactivate or Begin and End)
- IShaderProgram - Enable and Disable (or ...)
- Some concrete implementations:
- Material - A concrete implementation of IMaterial. includes a composite of material colors and properties, an IShader, and an ILight
- You should also data drive this. It will save you alot of time in the end. Define you own scene file format. The shader source can either be in this file, or local references to files can be in these files. The file would contain, models, any transformations on the models, textures, lights, materials, uniform variable mappings and shaders. This would be the first thing I would work on. XML would be a great choice for this if you know it. C# support is there already, for C++ the TinyXML and TinyXML++ packages are somewhat well documented.
Lab submission
Submit your source code (.cpp and .h, .cs files), and Visual Studio project and solution files. Do not submit any executable files. Submit an html or pdf file specifying what is being submitted and how to run your program. Zip your source and project files into an archive. Double check that your zip file does not have extraneous junk in it.
Use the following command on stdsun to submit your lab1
> submit c781aa lab1 Lastname.zip
Notes 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 c781aa lab1 lab1.c
> submit c781aa lab1 readme
will result in ONLY 'readme' remaining in the lab1 submission
You should do the following:
> submit c781aa lab1 lab1.c lab1.h .... readme
or
> submit c781aa lab1 lab1_dir
Where 'lab1_dir' is a directory containing all of the lab1 files to be submitted, or best of all (for both student and grader) is:
> cd lab1_dir
> submit c781aa lab1 .
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:59 pm. of the specified due data, and there is a 10% penalty each day (including weekends) for up to 60%. After that, you get zero.
Grading Criteria
Grading of the labs will be based on the following:
- 70%: Correctness and adherence to assignment specification.
- 20%: Readability, structure of code and good use of comments
- 10 % Proper submission
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 given a zero.