Fall 2005


Sample Code

Project 1
Project 2
Project 3

Basic Info

C++ hints

Update: 12/13/2005
Just to be clear: an articulation is when two pieces of an object move relative to one another - like a hinge. To move an articulation means to make one piece move relative to the other. So, a windmill is an articulated figure and having it spin around would be moving the articulation.

Update: 12/13/2005
There is a subtle bug in the P3 Sample code: If a car starts out in an intersection, it gets confused (since the direction it leaves an intersection depends on the direction it came from, so if it didn't have a from direction...). By an amazing random chance (I think its about 1 in a million), this never happened because the random placement of cars in the example program never put one in the intersection. If you added more cars, or if you re-seeded the random number generator, you won't be so lucky. The easiest solution is to avoid placing cars in intersections. I did this by changing my "main" routine to include the following (this is inside the loop that makes the cars):

// we need to pick a road to start on...
Road* startRoad = 0;
do {
   startRoad = theRoads[rand() % theRoads.size()];
} while (startRoad->is_intersection);
new RandomDrive(c,startRoad,.2f,rand() % 2);

Update: 11/30/2005
There are two bugs in the GrTown sample code. With the current version, nighttime drawing gets messed up. To fix it, place a line:


near the end of the Car::drawAfter method (before the two closing braces, after the clearColor command around line 155).

The second bug causes the street lights not to draw, and will also preclude any use of drawAfter in a hierarchical model. To fix it, replace the for loop around line 108 of TownViewWidget.cpp with the line:


You can also remove the declaration of the variable g (since it will no longer be used).

"Final" version - while there might be changes, they will be minimal and annoucned. In particular, we may add new suggestions for technical challenges and update the requirements of files to hand in. Because of the latter, we recommend you re-check this page before handing your project in.

Project3: Graphics Town

Project Due Date: December 13, 2005. Late assignments cannot be accepted after Friday, December 16th at 5pm.

Note: for this project you may work together. If you plan to do this, BOTH teammates must send mail to the TA before November 29th.


The goal of this project is to create a city. But, since you only have a few weeks, it may be more like a town.You will create a program that allows the user to explore the town by flying around in it, or by looking at it from the vantage point of an inhabitant.Your town cannot be a dead place: there must be things moving around in it.

What is in your town, as well as what is happening there is up to you. We hope you will be creative. Make houses, trees, stores, cars, roads, helicopters, construction equipment, people, boats, ...What goes on in the town is up to you - make the cars drive around, drawbridges open and close, construction equipment operate, ...

We hesitate to tell you what to do, since students in the past have come up with some really creative things - we've seen cities with skyscrapers, space cities with flying saucers, a Harry Potter city with flying broomsticks, ... Some things that students did in 2003 are shown here (but you might want to start with the gallery).

If this sounds like its arbitrarily open-ended, you have the right idea. Clearly, you could make this as fancy as you want. Obviously, we will try to set our expectations to be only somewhat unreasonable :-) Our goal is to give you the opportunity to demonstrate your competence at writing 3D graphics programs, as well as an opportunity to experiment with some more advanced topics that you think are interesting.

The basic requirements are very simple. You should try to achieve them in a manner that provides flexibility so you can add fancier features as time permits. In terms of which fancier features to implement? You should pick the things that are most interesting to you. We will give you lots of ideas...

We will provide you with a framework to build on top of. You may choose not to use it, but you must provide its basic functionality (things like navigation, the ability to jump to interesting places, ...). The sample code is not perfect, but will give you the opportunity to work inside of someone else's system, and to figure out someone else's program.

You will be allowed to work in pairs on this assignment, subject to some rules.

The Basic Requirements

Your town must have:

  1. At least 5 objects moving at any time (besides the ones that I made)
  2. At least 2 (3 for groups) different types of behaviors (besides the ones that I made)
  3. At least 3 (5 for groups) different types of buildings / scenery (besides the ones that I made)
  4. You must add at least 3 (6 for groups) new textures to the system. At least 1 (2 for groups) must be hand painted.
  5. You must attempt "enough" technical challenges (see the technical challenges page).
  6. You must have an articulated object (that moves its articulation) per person.
  7. You program must work at a sufficient frame rate (which isn't hard since the B240 computers are so fast. however, if your world gets really complicated, you might want to add culling and level of detail (see the technical challenges page).
  8. You must add at least 1 (2 for groups) things that are effected by the time of day.

There are three aspects of this project, all will be considered in evaluating your project:

  1. Technical challenge (how much hard graphics technique did you use)
  2. Visual Complexity of your world (how cool/interesting does it look - sometimes a few really interesting things can be as good as a lot of simpler things)
  3. Behavioral Complexity of your world (how interesting are the things that happen in it).

This is the order of importance. While having some degree of success in all categories is important, sometimes excellence in one category can outweigh deficiencies in another.

Historical Note

Graphics Town has been a popular project for the graphics class for the past several years. Students have enjoyed the chance to be creative, and we (the instructor/TA) like the chance to see lots of cool stuff. The open-ended nature of the project allowed students to spend energy learning / trying out stuff in graphics that they found interesting - including stuff that we don't get to in class.

This year, we have revised the project. Our goal is to keep the open-ended "learn what you're interested in and be creative" aspect, while being more specific about what our expectations are and making sure that the people take on enough technical challenges.

In previous years, we provided a sample solution for people to start with. It was (purposely) buggy and simple. About half the students chose to use it (vs. writing their own from scratch). This year, we've decided to spruce up the sample solution and encourage people to use it, so you can spend more time adding cool new things, and less time fixing our bugs.


The overall goal of this project is to give you an opportunity to explore topics in interactive graphics: how do you make things that look interesting, and be interactive. While some of this is artistic (you need to pick interesting objects to make and good textures/... to look nice), some of it is technical: you need to pick things that can be implemented efficiently and have interesting behavior.

In terms of your grade, effort spent on technical are more valuable. For example, it is better to spend your time making a simple "blocky" car drive around in an interesting way, or to make a simple shaped car out of parametric surfaces, or to light the car in an interesting way, then to carefully model a gorgeous model of a car. (of course, if you want to make model a gorgeous car, implement bezier patches to display its curved body, have it realistically race around a track ... - we won't complain).

Some specific things we want you to learn from this assignment (which will explain some of the requirements):

  1. To learn how to work within someone else's code - even if that code isn't perfect. (so, we'll encourage you to use my code as a starting point)
  2. To try out some of the technical topics that we've discussed in class (subdivision surfaces, culling, ...) or topics we won't discuss too much in class (particle systems, fractals, ...)
  3. To get some experience with how textures are used to make simple objects look more interesting.
  4. To get some experience with creating geometry for graphics.
  5. To gain experience working with a larger, more complex graphics application.
  6. To gain some experience creating the behavior/motion of graphics objects.
  7. To work with modeling an articulated object.

The Sample Solution

We will provide you with a basic implementation to get started with.

The original sample assignment was written very quickly in 2000. It wasn't pretty. But many students used it as the basis of their projects.

We have tuned it up a bit - a lot of what was broken (the flying controls, the following camera) has been fixed, and the internals have been cleaned up to be easier to understand. There are some new simple example behaviors, and the complex behavior (the driving model) has been cleaned up to be more understandable (albeit not as cool - but you might consider adding to that).

While the code isn't perfect, it is our expectation that it is easier to use it as a starting point than to start from scratch. Yes, you will be spending some time reading and figuring out some not-so-great code (as well as some pretty good code), but this is good practice.

There are some features that my code provides that are important for the project. You should make sure that they still work when you're done (and you need to implement them should you decide to start from scratch):

  • You must be able to fly around the town to look at things.
  • You must have "shortcuts" to go directly to places where particularly interesting things are.
  • You must have several vehicles moving around. (this doesn't necessarily mean cars - one student had a space-town with ships flying around, another in a Harry Potter inspired project had brooms flying around castles)
  • You must be able to control the time of day. The time of day should affect the lighting and the actions that occur.

The sample code is discussed on another page.

Working Together

For this assignment, we allow you to work with a partner. However, there are some rules for doing this:

  1. Each person on a team gets the same grade for the project. We appreciate honesty in saying who did the work, but if you are lucky enough to find a partner who does everything for you, well, ultimately you will lose out because you won't learn as much.
  2. Before the checkpoint (November 29th), you must send the TA email saying who you will be working with.
  3. After the checkpoint, you may not break up your group.
  4. All team members must be present at the grading demo.
  5. Each person must make at least 1 of the new buildings/scenery, 1 of the behaviors, 1 of the articulated objects, 1 thing effected by the time of day, and paint one of the textures.

While the expectations are higher for groups than for individuals, they are not that much higher.

What to hand in?

As usual, you must hand in everything needed to build and run your program, including all texture files and other resources.

If you work with a partner, please put a single file in your handing directory - a README.txt that says where to look.

In your readme, please make sure to have the following (you can break it into seperate files if you prefer):

  • Instructions on how to use your program (in case we want to use it when you're not around)
  • A list of the objects you modeled (if you made lots of different objects, just list the 5-10 most interesting ones). Please order the list so the most complicated/impressive one is first.
  • A list of the behaviors you made. Please order the list so the most complicated/impressive one is first.
  • A list of the technical challenges that you attempted / completed.

You should make a subdirectory of the project directory called "Gallery." In this directory, please put a few JPG pictures of the best scenes in your town. Please name the pictures login-X.jpg (where X is a number). Put a text file in the directory with captions for the pictures. (note: to make pictures, use the screen print and then use some program to convert them to JPG).


Unfortunately, it is very difficult to give a grading procedure ahead of time. Every project is so different.

The main thing is we'll look at the demos to see how cool/complex your world is and how well your technical components work.