Assignment 5 - Lighting and Texture Mapping - (100 points)

Due Date: 11/09/2011 at 11:59pm


  • Use GLSL to implement lighting and texture mapping
  • Gain experience with implementing techniques in shaders using Simple and Fast Multimedia Library (SFML)
  • Use SFML to load models, textures and other useful media

Downloading and Running the Sample Program (10 points)

For this assignment, you will be modifying the provided program. Download the starter code and get it to work on your machine or on Onyx. It includes a Visual Studio Project (2008 and 2010 project) and a XCode project. Download this version if you'd like to work on Onyx. Take a screenshot of the running program and submit it with your final submission.

Modifying the fragment shader (80 points)

  • In this assignment, the main aim is to implement lighting and texture mapping in the shader.
  • The light direction is given by vector L in the fragment shader and the view vector is given by vector V in the fragment shader.
  • Use the Phong Lighting equation to compute the final lighting for a single light in the scene to include the diffuse and specular component.
  • For this assignment, the final diffuse contribution is a product of the computed diffuse coefficient and the diffuse texture lookup (diffuseMap)
  • Similarly, for this assignment, the final specular contribution is a product of the computed specular coefficient and the specular texture lookup (specularMap).
  • Add appropriate lines to the fragment shader to get the effect as shown in the screenshots included in the zip file.
  • Hint: Use texture2D() for texture lookup. Also look at the OpenGL Shading Language specification for more information about any shader related functions.

Extra Credit

  • Use the third texture models\dragon-transparency.jpg to include transparency.(10 points)
  • Find and load new models into the project and perform lighting and texture mapping on them. (30 points)

Submitting the Assignment

Required files

Please include ONLY the following files for submission.

  • C/C++/GLSL source code files
  • Screenshots of your output
  • Makefile
  • README - This should be a text file (.txt) and should include your name, a list of the files being submitted, any GLSL functions you discovered and used, which extra credit you implemented (if any) and anything you want to tell me about this assignment. Please mention the names of students you worked with or websites you used for this assignment.
  • User manual - A manual.txt file and list any key/mouse combinations for customized interaction (zooming, etc.)

Put ONLY the required files for the assignment in a single directory, change to that directory and submit using the following command:

submit alark cs464 5