![]()
|
EECS487 F09 Programming Assignment 2: Scene Graphs and ShadersThe project is due on Monday, 26 October, 2009 at 12:01 pm (one minute after noon).OverviewIn this project you will implement a simple model viewer that uses a simplified X3D scene graph as well as two simple programmable shaders. You are given support code for this project that should
compile under Windows and Mac OSX. The makefile has support for
the CAEN Linux workstations but those do not have great graphics
drivers and the programmable GPU shaders will not work there.
Graded tasks overview (100 points total)
Optional tasks (for fun, not credit)
Implementation detailsCylinder renderingModify the
Camera examine modeThe simple X3D viewer and parser included with the project does not include a camera class.
All the viewing information is stored within the X3Viewpoint
node. In the support code the camera is positioned
at the location read from the Viewpoint position attribute (all
other attributes of Viewpoint node are ignored in our
viewer). The camera points toward the origin of the world
coordinate system which is set up to have the positive
y-axis pointing upward. The horizontal motion of the mouse (dragging with the
left button pressed) causes the camera to rotate around the
y-axis, called yaw, around the scene. You will need to implement zooming in and out (mapped to
vertical motion of the mouse with the right button pressed),
as well as vertical camera motion (mapped to the vertical motion of the mouse with the left button
pressed) such that the camera tilts up and down, or changes pitch. The camera should remain pointed toward the origin of the
world coordinate system (optionally, you can also compute the
center of the bounding box of the whole scene and point toward it). You will need to modify the Modeling transformation hierarchyThe scene graph represents the scene as a directed acyclic graph (it is not a simple tree since some nodes can be reused multiple times using DEF/USE node attributes) and the traversal of this graph is performed when the scene is rendered. The grouping nodes such as scene, group, and transform traverse their children so that each child renders itself. The transform node adds the ability to specify the transformation between the child coordinate system and the parent coordinate system so that children can be specified with respect to their parent nodes. The X3Transform in the source code has all transforms except for the scaleOrientation transform which we skip. Lighting setupIn our viewer we shall only implement point lights and each
point light will effect the whole scene, therefore a
separate pass is needed to setup light positions (and other
parameters) before the scene is rendered. Each point light can be
located within the child nodes of the hierarchy and is thus
transformed by the current modeling transformation of its parent (this allows
a light to be located near a particular object). The
recursive traversal of the nodes to find the lights is done by using Material setupWhile working on the light setup from the previous section
you will also need to setup
material properties within the Computation of mesh normals and mesh rendering
X3IndexedFaceSet represents a polygonal mesh node that contains a list of vertex indices and a
coordinate node that stores the (x,y,z) point coordinate list into
which the indices refer. Polygon index lists are separated by -1.
Many models mostly use quads and triangles. Thus, after reading
the index list we process it to extract two separate lists of
quads and triangles (stored in the appropriate fields of the
You will also need to implement mesh rendering within the
GLSL shadersThe last two programming tasks will be done in a C-like
language. You will first need to implement a per-pixel version of
the lighting model where most of the work will be done in the fragment
shader The "interesting" shader task is an open-ended task and you can implement any nice or weird looking shader. Examples of interesting shaders may include the brick procedural texture or some cartoonish looking textures (note that the provided interesting.vs/fs already implements some simple cartoon shading so you need to come up with something a bit more interesting). Be original; do not simply take some random dot product, multiply by 4, take the square root, and convert to rods per hogshead. Think it through and make sure to explain and understand the choices that you made. Support code detailsFirst of all, download the support code archive from
/afs/umich.edu/class/eecs487/f09/PAs/pa2.tgz The executable should be called with one command-line argument -- the name of the X3D scene file (there are a bunch of them provided in the data folder, there are many on the web, and some graphics packages can export to X3D). The following keystrokes are defined in the GLUT window (you
may map more operations to keys inside
The code needs to be linked against GLUT and Expat libraries, and the compilation requires the corresponding header files. The Mac OSX machines in the CSE building lab seem to have both installed. For the Windows version, you will need to copy common/bin/libexpat.dll to somewhere in your path. If you have a Linux machine with good drivers then you may simply use the Makefile file provided with the project archive. Windows specific:Copy libexpat.dll to somewhere on you path. Specify the X3D file name in the Debugging options or run the program from a command line. Visual Studio project files are not provided. Please create your own project following the instructions in my GL/GLUT writeup. Please submit your project files. Mac specificAnyone using Mac OSX 10.5.x or 10.6.x will get the following warnings when compiling: ../common/src/glew.c:80: warning: 'NSAddImage' is deprecated (declared at /usr/include/mach-o/dyld.h:230) ../common/src/glew.c:89: warning: 'NSLookupSymbolInImage' is deprecated (declared at /usr/include/mach-o/dyld.h:182) ../common/src/glew.c:91: warning: 'NSAddressOfSymbol' is deprecated (declared at /usr/include/mach-o/dyld.h:188) These are due to the fact that there is not a current implementation of GLEW for Leopard and Snow Leopard. These warning may be ignored without problem or difficulty. Submission GuidelinesAs with PA1, to incorporate publicly available code in your solution is considered cheating in this course. To pass off the implementation of an algorithm as that of another is also considered cheating. For example, if the assignment asks you to implement sort using heap sort and you turn in a working program that uses insertion sort in place of the heap sort, it will be considered cheating. If you can not implement a required algorithm, you must inform the teaching staff when turning in your assignment, e.g., by documenting it in your writeup. Code that does not compile will be heavily penalized. Make sure your code compiles and works on CAEN machines. You will need to turn in your source files together with appropriate Makefile (and/or IDE project files) and a write-up in text format (writeup-uniqname.txt) that discusses:
Copy your code, write-up, and any other supporting files
(Makefiles or IDE project files etc.) to the following
directory on IFS
For accessing the umich.edu AFS partition from CAEN machines you might first have to obtain AFS tokens. On Linux, this is performed using the gettokens command on the terminal, followed by your ITCS password. On Windows, invoke the Start Menu -> All Programs -> Communication Tools -> Open AFS -> Authentication which will create a lock icon in your system tray. Click that to get the AFS authentication dialog, click "Obtain New Tokens..." and enter your ITCS uniqname and password for the umich.edu cell. Turn in ONLY the files you have modified. Do not turn in support code we provided that you haven't modified.Do not submit any binary files (object, executable, or image) with your project. The timestamp on your source files and your writeup will
indicate the time of submission and if this is past the deadline
your submission will be considered late. Therefore, you are
allowed multiple "submissions" without late-policy implications
as long as you respect the deadline. Test the
compilation! Your submission must compile without errors
and warnings on CAEN machines. Mention the
platform in your writeup. General InformationThe General Information section from PA1 applies. Please review it if you haven't read it or would like to refresh your memory. |