Project 1 - Mirror Mirror

Due 9/22 at 11:59pm Chicago time


The purpose of this project is to learn about GLSL shaders by experimenting with various GLSL shaders.

There is a long history of literary characters interacting with talking heads - from the Brothers Grimm story of Snow White and the Queen with her 'mirror mirror on the wall' through the 2-way television screens of George Orwell's 1984.

In this project you will implement your own head on your computer screen that you can talk to, although it doesn't need to talk back.

You should write 5 shaders to modify the look of the head on your screen - 3 fragment shaders and 2 vertex shaders. You should not just be re-implementing existing shaders - you need to add something new to each of the shaders. These should not be random shaders thrown together - It is good to have a theme - e.g. the examples given above.

The user should be able to switch between the various shaders on the fly so the contribution of each shader can be seen in isolation from the others (e.g. the number keys might be a good way to do this)

For this project you should use GLSL only so everyone has a common comparable set of code, no CUDA, no other shading languages. We will get to CUDA in Project 2, and people will be free to pick their shading language in Project 3.


Here is a sample program including a sample head that you can use as a starting point. You can use this head model or you can make your own. The head here is an obj file which is loaded in using Bob Kooima's obj loader. This program uses three simple shaders. Pressing 1 shows an environment map in the fragment shader and slightly deforms the head using a vertex shader. Pressing 2 shows a toon shader. The head turns to follow the mouse in the window so you can see the various sides of the head.

ogl.cpp
obj.c
obj.h

Makefile for OS-X
Makefile for linux

env.vert
env.frag

toon.vert
toon3.frag

MarsMap.raw
aj2.obj


To compile under visual studio 6 under XP I needed to grab glext.h and add it into the standard visual studio include files. I added -DCONF_NO_PNG -DCONF_NO_JPG to the C/C++ section of the Project settings so the object loader wouldnt need those libraries.



If you create five decent shaders with some novelty in each one then you will get a B. To get an A, you need to combine these shaders together, possibly with more shaders, to make the resulting head look really cool.



To turn in your project you should set up a web page describing your work, including the well-commented source code and required files to be able to compile and run your program, and some screendumps showing what your application should look like when its running. You should then email andy with the location of this website before the deadline. It  would probably be a good idea to put a backup copy of the web page at a second website just in case I can't get to the first one.

As part of this web page you should describe each shader and say what is new about it. Other people should be able to read your web page and understand how they can make use of all your cool shader ideas. This way we can share these methods with the rest of the class.

When you send andy the location of your webpage you should also email a screen snapshot of your head that is 320 pixels wide by 240 pixels tall in jpeg format named p1.<your_last_name>.jpg. This image will be used on the class web pages along with the link to your project web page.



Each student will also give a short presentation about their project in-class and answer some questions about your work. You should prepare a good presentation - you can use your project website, or create some slides. You should definitely run your code and show your shaders to the class. Be sure to practice your presentation so you finish within the alloted time so everyone has equal time to present.



last revision 8/31/08 - clarified which shading langauges were available for use on this project, added linux Makefile, cleaned up the code a bit, tweaked code to be happier under windows