Assignment 2: OpenGL
Due: 10/17/99 at 11:59PM.
Overview
This assignment serves as an intoduction to the OpenGL graphics library.
You will required to generate a room scene which can be navigated in a
walk-through fashion. Emphasis is placed both upon the implemention
of OpenGL's basic capabilities (e.g. shading. lighting, transparency, materials
properties, etc.) and their use in generating more involved effects (e.g.
shadows, reflections.)
Examples
Samples of last years projects are available here
and below are some additional images (click to enlarge).
|
|
|
Transparency on table top
Reflection in the floor
Multiple light sources
|
Specular lighting on balls
Shadows on the table surface
Lamp is dynamic light source
|
Texture mapping on board
Full scene antialiasing
Replicated objects
|
What you Have to Do
The assignment is
worth 15 points. The following is a list of features that you may implement.
The number in parentheses corresponds to how many points it is worth.
Options in bold are mandatory.
-
(1) Four walls, a floor and ceiling. You should use backface culling
so you can see in while outside the room, but not see out while inside
the room.
-
(1) A table, several chairs, etc. You may choose more interesting
furnishings. E-Mail the T/A
with your proposals if they differ significantly from last years' samples.
-
(1) At least one transparent surface, perhaps the table top.
-
(1) At least three texture mapped surfaces, each with a different
texture.
-
(1) At least three point or spot light sources.
-
(1) At least one animated object (such as a rotating ceiling fan,
a clock, etc.)
-
(1) Rendering controls. Use glut menus to allow the user to select
between Flat or Gouraud shading, and any suitable controls for your extra
features (e.g. number of jittered samples for anti-aliasing).
-
(1) Keyboard and/or mouse control to facilitate moving about the
interior of the scene. The minimum would have left/right arrows turn you
around and up/down move you forward/backward, but a Quake/Doom style interface
using keyboard and mouse would be ideal to facilitate more degrees of freedom.
-
(2) A Luxo Jr. style lamp with keyboard and/or mouse controls for manipulating
the joints of the lamp interactively while the spot light representing
the bulb moves accordingly. Hint: see the robotic arm example in the OpenGL
Programming Guide.
-
(2) A curved surface, other than a sphere, cylinder, cone, etc.
-
(2) An animated texture (e.g. a slide show on a wall)
-
(2) A mirror. Hint: Reflect the world about the mirror and render it again
through a stencil buffer.
-
(2) Shadows on at least one surface (such as the floor or table). Hint:
See the OpenGL Programming Guide for the transformation which renders objects
onto a plane.
-
(2) An alternate viewing scheme in which the camera moves around the exterior
of the scene, looking into the scene from above. A keyboard control
should be added to toggle between interior and exterior viewing schemes,
and mouse controls should be added to provide a "crystal ball' style interface
for the exterior viewing scheme. See the FAQ below for a description of
this.
-
(2) An object that responds to user mouse clicks (such as a light switch
which turns on/off a light when clicked on by the user).
-
(2) More than one transparent object. You will receive points only if there
are no visible artifacts. Hint: You'll have render your objects in a particular
order depending upon the viewpoint.
-
(2) Full scene anti-aliasing using the accumulation buffer. Hint: See the
OpenGL Programming Guide for information about jittering.
-
(2) Variable Level of Detail. Continuously vary the complexity of tesselated
surfaces depending upon the distance of the viewer from the object. Hint:
Use this with GLU cones, spheres, cylinders which take arguments for their
complexity.
-
(3) Include particle effects (e.g. steam from a teapot). Hint: Maybe try
rendering randomly moving, small triangles with a texture map of a dot
on them... Make sure the effect is convincing.
-
(?) Impress us with something we hadn't considered...
By implementing all the required features, you get 8 points. There are
many ways to get more points:
-
implementing optional features (as listed above),
-
submitting images for the art contest (1), and
-
winning the art contest (1).
It is possible to get more than 15 points. However, after 15 points, each
point is divided by 2, and after 17 points, each point is divided by 4.
Getting Started
You should use the code available at /u/cs426/2/, on the MECA
machines, as a starting point for your assignment. We provide you with
two files:
-
main.c: Skeleton code for the main rendering loop and object definitions.
-
Makefile.nt A Makefile suitable for Windows NT platforms.
-
Makefile.unix: A Makefile suitable for UNIX platforms.
After you copy the provided files to your directory, the first thing to
do is compile the program. If you are developing on a Windows NT machine,
running Microsoft Visual C++, from the MS-DOS prompt, type:
% copy Makefile.nt Makefile
% "c:\Program Files\Microsoft Visual Studio\VC98\Bin\vcvars32"
% nmake
If you are developing on a UNIX machine, type:
% cp Makefile.unix Makefile
% make
In either case an executable called scene or scene.exe will
be created.
If you have trouble compiling on NT you may not have glut on your system.
First search for glut.h and glut32.lib, and adjust the first two lines
of Makefile.nt appropriately. Otherwise, download glutdlls.zip
and unzip the files into locations consistent with the first two lines
of Makefile.nt. In particular, glut.h should be located at (include_path)/GL/glut.h
and the glut32.lib should be at (lib_path)/glut32.lib.
What to Submit
You should submit:
-
the complete source code with a Makefile,
-
the images for the art contest, and
-
a writeup.
The writeup should be a HTML document called assignment2.html
which may include other documents or pictures. It should be brief, describing
what you have implemented, what works and what doesn't, how you created
the art contest images, and any relavent instructions on how to run your
interface.
Make sure the source code compiles in the MECA
workstations. If it doesn't, you will have to attend to a grading session
with a TA, and your grade will suffer.
Always remember the late
policy and the collaboration
policy.
Hints
-
See Appendix D in the OpenGL Programming Guide for details about GLUT functions
or visit this site.
-
Use pre-cooked GLU functions to produce spheres, cones, cylinders, etc.
as primitives for more complex models. The OpenGL Programming Guide describes
much of GL and many GLU resources or visit
this site or this
site..
-
Use display lists to radically immprove rendering speed.
-
Download the first week's precept slides (.pdf): ass2.pre1.pdf
(.eps): ass2.pre1.tar.gz. (Some browsers
drop the .gz extension when saving. Hold shift and click the link
to download correctly)
-
Download second week's precept slides. This version might be updated
Friday: (.pdf) ass2.pre2.pdf (.eps) ass2.pre2.tar.gz
(See note above for downloading tip)
-
Go to /u/cs426/OpenGL/book for accpersp.c and jitter.h. You'll need
part or accperp.c to get full scene antialiasing working.
This is the code from the OpenGLL Programming Guide.
Stay tuned for more hints.
FAQ
What it a 'crystal ball' style interface?
When the user holds the left button, moving the mouse left and right
should rotate the world left and right about the world's origin, and moving
up and down should rotate the world up and down about its origin.
If the user hold the middle button, then moving the mouse up and down should
zoom toward and away from the origin. Some implementions also provide
the ability to hold both buttons to cause mouse motion to translate the
world in a plane parallel to the viewport. This should alter the origin
for the previously mentioned rotations, so you might add a control to reset
the origin should the user end up in a strange state.
Announcements
Stay tuned for more announcements.
Last update: 10/14/99
04:23 AM