CSE 5542 Lab 1
Lab Assignment #1
Due: October 10, 2017.
Lab overview: Modify the application for viewing a 3D model using GLSL shaders.
Objective: Upon finishing this lab, you will understand GLSL shaders used for diffuse and specular lighting 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 creates polygonal models procedurally and displays them model using materials and GLSL shaders. Download the DemoFramework from the course web site as a starting point. It will need to be changed to remove the old fixed functionality (i.e., no glNormal, glVertex, glLight, glRotate, etc.) The renderer should contain the following features:
- (10%) Finish the Examiner / Trackball viewer code to pan (actually crab) and dolly the camera / world. (see ExaminerComeraNode). Understand the layout and the trackball class.
- (10%) Modify the DrawableSphere to use a tesselation of dual pyramids as discussed in class (estimated less than 2 hours). Extra Cedit (5%) Perform the tesselation in a set of tesselation shaders. Compute normals either on the CPU or in the shaders.
- (10%) Modify the DrawableCube to use either a a vertex buffer object, indexed drawing and optinally, a vertex array. Specify normals for each face as well as colors for each face (estimated about 1 hour).
- (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%) Implement ambient, point and directional lights and a light manager. Create a struct in GLSL for the light and material properties. Your shaders should take in a list of lights and the number of lights. (about 2 hours). Extra credit (5%) Add a spotlight.
- (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). Extra credit (5%) Additional shadings: 1) Faceted shading; 2) Silloutte shading; 3) Your choice.
- (10%) Create a scene (2 identical ones in the same scene) with per-vertex lighting on one set of objects and per-fragment lighting on another. Experiment with the tesselation to see the different effects.
- (5%) Improve upon and / or use your backgrounds from Homework #1.
- (5%) 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 glutBitmapCharacter (see DrawableRenderState for exampe), or GIMP). 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.
- (10%) Write-up a 2-5 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)
- Get started early.
- Test that your framework compiles and runs before you modify code.
- Use a source code repository to track changes, so you can see what you changed if / when things break. Commit often (every 5 lines of code changed!).
- Consider a video capture tool to better illustrate the difference and to add as a highlight to your blog / resume.
- Decent blog on lighting.
- Here is a tutorial using glDrawElements to render a cube with different face colors.
- You will need the DevIL image library to read images (or replace it with your own).
- The C++ Preprocessor should have the following definitions to use TinyXML. This should be set, but if not, in the Project Properties add: WIN32; TIXML_USE_TICPP;
- Delete the reference to ICommand.cpp and ITextureBindManager.cpp. I renamed those. Also add TextureBindManager.cpp and NullCommand.cpp
- Change the scene being loaded to only use the material White (rather than Emerald and others).
- Here is a simplier Main program to understand the framework perhaps easier. Most is boilerplate. Remove DemoFramework.cpp and add Cube.cpp to the project.
- For Shader Program Constants, look at the IShaderConstant interface and ShaderConstantCollection. A sample is given in ShaderConstantVec
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, including the hidden .vs folder.
Use the following command on stdsun to submit your lab1
> submit c5542aa 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 c5542aa lab1 lab1.c
> submit c5542aa lab1 readme
will result in ONLY 'readme' remaining in the lab1 submission
You should do the following:
> submit c5542aa lab1 lab1.c lab1.h .... readme
or
> submit c5542aa 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 c5542aa 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.