Introduction to OpenGL
Due: Apr 1, 11:59pm (Partners must be formed
at time of submission HW 2, Milestone due Mar 6, 11:59pm) .
You may work on the assignment over spring break if you want (certainly not required), but TA/instructor support may be minimal.
The goal of this assignment is to get you started using the OpenGL graphics library. You will create a complete scene, with user controls. The emphasis is on understanding and implementing OpenGLs basic capabilities, as well as using them as building blocks in generating more complex effects. Your main textual reference for this assignment will probably be the OpenGL programming guide. Besides, you may want to look at the material on OpenGL in lecture, and the sample program that was written there. While you can look at the examples there for inspiration, in general, you may not simply copy that code for parts of the assignment.
So as not to stifle your creativity, we give you freedom in defining your scene, subject to implementing the functionality specified below. You may also want to take a look at the model assignments, linked from the main assignments web page. The project one of those years required one to prepare a final animation of your scene. While you might want to do this anyway, it is not required this year.
Finally, I am sure that many of you will want to go overboard with this assignment, and create something at the complexity level of a feature film. However, it makes sense to keep the specific requirements in mind and add features in a modular and incremental fashion instead of having this grand design and having nothing done when the assignment is due. It also makes sense to get the required functionality working before adding optional features.
Your final assignment must be a Visual Studio 6.0 file. Zip everything up and email it to firstname.lastname@example.org, as in the other homeworks. Place a readme file that describes how each of the requirements was fulfilled and can be seen by the user. Do not use any non-standard libraries. Your project must compile and run without the need to link to any libraries or load any dlls, beyond what exists on a standard installation of WinXP with glut and openGL. If you do not use VS6.0, make sure that your project will compile and link by simply compiling all of the .cpp files. No complex dependencies.
However, if you feel you absolutely must do something funky and platform-specific, that's probably ok too (check with the TA), since we will largely be grading these in demo sessions. You are responsible for finding a machine to demo your program if it won't for instance run at MRL.
Use the newsgroup! Don't put up any code, but please discuss your problems and solutions. USE DESCRIPTIVE SUBJECT HEADINGS!!!. The TA will not respond to any posts with subjects such as "HW3: Problem with scene" or even "HW3: Can't make mouse work"
You MUST work in groups of 2. For CVN students working alone, you do not need to do anything with an * before it.
This can be a challenging assignment because you are new to OpenGL. To make sure it's fun, rather than a nightmare, and to avoid procrastination, we have introduced an intermediate milestone. The milestone will be worth 10 points, and the assignment itself worth 70 points. The point of the milestone is not so much for grading purposes, but to get you to start early on the assignment, and especially to seek help from the instructor or TA if you have problems, before it is too late. In any case though, if any problems arise at any time, please seek assistance from the instructor or TA.
For the milestone, you should submit the following. This may be submitted by e-mail as usual to email@example.com although I would prefer if you created a website with the relevant information and simply sent a URL pointing to it.
There is a helper scene that essentially implements hw1, but with an object that is loaded from a maya .obj file, and a texture. You can use this as a reference, but keep in mind that the design of this code is not clean, and will not scale well. Some students found this code hard to read and understand; it is not required that you use this material at all. If you do look at it, note that the normals are not read properly in the helper code. If you are interested, you can modify the helper code to read this information from the normaldata array in the demo program. Apart from this, there is no framework for this assignment; you are completely on your own. If you are having difficulty figuring out where to start, or how to implement some of the most basic functionality, look at the helper scene , the program written in class, or any of the programs in the OpenGL guide.
3dto3d cat.3ds /if1 /of19. You can use /of18 for your own instruction, but do not use any such generated code in your scene.
We describe several optional features you may want for your scene. Please note that while we will give extra credit for these features, the most points will be for implementing the compulsory functionality above, so focus on that first. Relative to the requirements, the number of points per unit effort for the extra credit below will be low.
Display Lists Use Display lists to optimize your implementation. Try to measure the speedup as a result.
Shading Controls Implement controls that allow the user to move between various shading styles like flat, Goraud, Phong, wireframe etc. This might be a useful tool in debugging anyways.
Reflections and Refractions Add surfaces like mirrors as well as transparent surfaces (like making a barn wall transparent). Note that OpenGL can't do out of order transparency, so you will need to manually specify the order of shading objects.
Shadows Add shadows on at least one surface. See the OpenGL programming guide for hints and the required transformations.
Environment Maps Add the capability to have lighting from a complex environment. The OpenGL guide describes how to render perfectly reflective objects. You can also prefilter environments to render diffuse objects. Ask me for details if you plan to pursue this.
Advanced Image-Based Techniques Images can be used in a variety of ways besides simple texture or environment mapping. Chapter 5 of the Real time rendering book has more details. One can also use stuff like sprites, that is, 2D images used as impostors for 3D objects and a variety of other approaches. If you're really into it, you could build a renderer based on image warping.
Full Scene Antialiasing You'll need to render the scene multiple times using the accumulation buffer. See the OpenGL guide for details.
Multipass Rendering OpenGL provides the basic building blocks on which a variety of realistic rendering effects can be based. Modern video games often use a number of passes, each drawing the same scene with varying parameters, for each frame to create realistic effects. Among the effects possible are soft shadows, full scene antialiasing, motion blur, depth of field, bump mapping, reflections, refractions, compositing, etc. The OpenGL book and the web are good sources of information.
Global Illumination You can employ a small amount of particle tracing along with OpenGL to add some global illumination effects like diffuse interreflection, or more complex reflections and refractions. See me if you're interested.
Animated Textures Allow textures to be time varying on some objects such as a slide show.
Parametric or curved Surfaces Add curved surfaces other than spheres, cylinders, cones etc. You can also experiment with NURBS surfaces in OpenGL.
Hierarchical Scene Graph and Object Instancing You may maintain your objects and subobjects in a tree or hierarchical scene graph. This also allows for efficiently instancing objects, hierarchical transforms etc. For the instancing, you should consider nontrivial hierarchically defined objects like a car, not just spheres or cylinders.
Level Of Detail If your scene has thousands of polygons, you will want to draw only a few of them to keep your frame rate good. You may experiment with keeping versions of your objects at multiple resolutions and using the appropriate one based on the distance of the user from the object, and other metrics. This is particularly useful if your scene includes a terrain model or other complex geometry.
Culling To maintain performance, 3D applications often avoid drawing unseen geometry. Two useful procedures are view-frustum culling (avoiding drawing objects outside the view frustum) and occlusion culling (avoiding drawing occluded objects). For the former, you could build a bounding box hierarchy of the scene. If a simple test on the upper level bounding volume indicates it doesn't intersect the view frustum, one needn't draw any of the objects. For occlusion culling, one possibility is to precompute visibility relationships, as from certain viewpoints in a room (if you are drawing a palace, maybe you could do a separate computation for each room).
Particle Effects Include particle effects like steam from a teapot. This is hard to do right; see if you can get something that looks convincing. You could render the particles as small randomly moving triangles.
Procedural Modeling One may use procedrually computed (perhaps fractal) models for objects like mountainous terrains, plants, fire, smoke etc.
Physically based Animation/Collision Detection Your animations can be physically based and use notions of dynamics to generate realistic motions. You will want to handle collisions such as a ball bouncing off the ground. Collision detection and handling is quite important in games and can be useful even if you don't have physical simulation built in.
Anything else you can thing of Feel free to surprise us with ideas that haven't been mentioned.