CS559 Spring 2001: Project 3
A Model Railroad
Due Date: 5pm Friday May 11
Project Source Code
New Hint: You are free to change the existing program in
any way you like. Change the textures, move the tracks (the train follows
them), change the OpenGl settings.
The Basic Task
This project is all about modeling, and gaining experience with many
more of the features of OpenGL. The starting point is a small virtual
space that consists of a grassy plain with a railroad track running
around it. A train, just a box for now, runs around the track at
constant speed. Your task is to model and render the train and other
structures in the environment.
Like project 1, this project defines a set of sub-goals with points awarded
for each goal. Unlike project 1, the goals are far more loosely defined,
so there is scope to try interesting things to get all the points available.
You may work in pairs. If you choose to work in a pair,
then each member of the pair will get half of the earned points. Once
again the maximum number of points, per person, is 100, but there are
well over 200 points available. To submit as a pair, one person submits
the code and both people submit a readme saying who they are working with.
The Tasks
- Texture Mapped Polygon Modeling Max 50 points
- Add one or more texture mapped polygon objects to the environment.
For example, add some houses with peaked roofs and texture maps
for the doors, windows and roof shingles. Other objects are
encouraged. Points will be awarded for successful use of texture maps
and the complexity of the models (without using outrageous numbers
of polygons).
- The Train Max 50 points
- Make the train a train. The train you design must have some animated
pieces, including wheels that go around at the right speed. The
train must continue to move around the track and must continue to
be aligned with the track, as the existing box is. Clearly, you should
get rid of the box. You can only get all 50 points if you have rotating
wheels and at least two other animated pieces. Be warned, carriages are
hard.
- Bezier Surfaces Max 50 points
- Add something made of Bezier patches to the environment. Possibilities
include but are not limited to silos, round roofed barns, or the boiler
on a steam train. You are not allowed to cheat and use the OpenGL
Bezier functions, but that limits you to 40 of the 50 points. You
must do subdivision to get all 50 points, and you must have multiple
patches joined with C1 continuity.
- Fractal mounds Max 50 points
- Add some mounds, or something else (a garbage heap) modeled as
fractal terrains. They must be texture mapped to get all 50 points.
Be careful not to disturb the train tracks, although if you really
really want to impress me then make the tracks go over the mounds.
- L-system Trees Max 50 points
- Add some trees or plants defined by L-systems. To keep the polygon
count low these will have to be very simple. Maybe pretend it's winter,
which means you can do fractal snow drifts instead of fractal mounds
(see above).
- Change the Navigation System Max 50 points
- The navigation system now is not great. Change it to something
better. To get all 50 points, you must have a mode where the viewer
rides the train.
The Program Skeleton
The program skeleton is an extensive piece of software. Here are some notes
on its operation:
- Back-face culling is turned on, so face with normals that point away
from the viewer will not be drawn. Polygon vertex order is used to
determine that normal, so you must always order polygon vertices
counter-clockwise about the outward-pointing normal.
- One light is defined and turned on. It is a directional light source
with no specular component, so do not define specular components for
your models. The light is coming in at an angle, so all the faces of
an upright box have different shades. With lighting turned on, you must
specify normal vectors for all your objects. (Actually, you could locally
turn lighting off, but it would look weird).
- Normalization of normals is turned off. So you must supply unit normal
vectors or lighting will not work correctly.
- Texture mapping is used for the ground plane. In particular, it
uses mipmapping and a targa image. You do not have to use either of
these features with your own texture mapping, but for anything other than
the simplest textures, it is probably sensible (and you can copy the code).
The Interface
The existing simple interface uses three mouse buttons. Moving the mouse with
the left button pushed rotates the world about a fixed point - the look-at
point. Moving the mouse up or down with the middle button pushed changes
the distance from the viewer to the look-at point. Moving the mouse
with the right button pushed translates the world - by moving the look-at
point in the ground plane. It's not the best, but it is relatively simple.
Hints and Suggestions
- Have fun and be inventive.
- A key thing to consider is polygon count. Graphics hardware can
only display so many polygons in a second, and if you try to display too
many the frame rate will collapse. Texture maps also use memory, so
too many textures can even more dramatically affect performance.
To keep polygon counts down, allow larger errors in curve subdivisions,
and avoid lots of complex terrain or L-systems.
- The way the train alignment is set up, it is simplest to do just a
locomotive, and a short one at that. Doing a long locomotive and having
it look like it's following the track is quite difficult. Doing carriages
and having them follow at a constant distance and follow the track is
even harder.
- Make use of the OpenGL error checking mechanism. It is described in
the red book.
- Start simple - just try to get a polygon to appear in the center of the
world.
- The way the current train transformations are set up, the origin for
the train is assumed to be at the bottom (at track level) and between
the two rails.
- It is OK to have multiple modeling techniques in one object. For
instance, you could have a train made up of some texture mapped polygons
with some Bezier patches, and animated in a hierarchical fashion. You get
all the points if you do a sufficient amount of each technique.
- It is OK to borrow code from other sources - but not other students.
You will probably learn as much trying to figure out how someone else's
code works as you would doing it yourself.
- Texture images abound on the web, so feel free to use them. Or you can use
a program like Photoshop to create your own. You might even find a use
for the first project.
This example program demonstrates many of the tasks you might choose to do.
It includes:
- Polygon mesh houses, and polygon mesh pieces for the train. The houses
are texture mapped.
- An animated train with wheels that go around and connecting rods.
- Fractal terrain hillsides.
- Bezier patches for the barn roof and the silos, with the silos
demonstrating continuity (first order). Each silo is made up of 8 patches.
The barn roof is a single patch, and the barn walls at each end are also
patches, so that they meet the roof correctly.
- If you hit the "t" key then you start to ride the train. Hitting "t" again
puts you back where you were before.
It does not demonstrate L-systems. This program would be good for about
225 points. It should do more for the view change (such as a "walk" mode)
and would need to do L-systems to get the full 300 points.
Back to CS559 Home Page