Computer Graphics project: The Zoo
Back in 2004, for my computer science study I had a course about Computer Graphics. More specifically, the practical consisted of several assignments with OpenGL. The final assignment for this project was to create some kind of world with the standard SGI dinosaur model. You were allowed to do whatever you want as long as it was a basic world with the dinosaur in place.
Because I liked the project I put a lot of effort in the assignment and ended up with a complete 3D zoo including collision detection and animated animals. Because of tight deadlines not everything is as I wished but I was pretty happy about most of it. The project was rewarded with a place in the course's hall of fame, along with some other projects.
You can download a Windows executable at the bottom of this page, as well as the C++ source code of the complete project. Hopefully there is some useful code inside, in any case you are free to use it.
Movie
A short tour of the zoo:
Screenshots
Below are some screenshots of the project, you can click on them to view them fully sized. There are three basic 'rooms' in the zoo. One with the dinosaur (which was mandatory), one with a bird on a tree along with a staircase and finally an aquarium with swimming fish.
Features
Some of the features include:
- Static world and animated dynamic objects
- Textures and lightmaps
- Alpha transparency
- Collision detection
- Portal engine
- Frustum culling
- Skybox
Renders
Here are some original ray-trace renderings and wireframes from 3D Studio of the 3D world. Notice that originally I had two birds in the scene. In one of the wireframes you can see the paths the fish are swimming.
World model
The 3D world was originally created in 3D Studio, then exported to the ASE format and finally converted to a custom format basically consisting of serialized C++ objects in a custom serialization format. The tool to convert ASE to this format is not published since it was quick & dirty code not ever meant to be published. I don't think it is very useful either since the code for the animation etc. is pretty specific to the 3D world data. The source of the project itself is published because it contains lots of useful algorithms and techniques.
Usage guide
Usage of the program is simple:
Mouse
The mouse can be used to look around. A left click enables or disables looking around.
Keyboard
With the keyboard you can walk around and do some other stuff. The key mapping is as follows:
ESC / q | Quit the application |
---|---|
Space | Pause the animation (and walking) |
Enter | Show statistics |
F1 | Toggle between full screen and windowed |
Up arrow | Walk forward |
Down arrow | Walk backward |
Left arrow | Strafe left |
Right arrow | Strafe right |
Left click | Toggle looking around with the mouse |
Source code
I have now published the source code as well. The code is written in C++ and uses OpenGL and GLUT. I have included a project file for Visual C++ 2008 Express which should compile the project right out of the box. This great compiler and IDE can be downloaded for free at Microsoft's website, see Visual Studio 2008 Express Editions.
Note: the source code version is slightly different from the source that was used to built the binary. Because of the requirements in the assigment the final binary needs lots of external files (GLUT, the 3D world, textures, etc.) and is quite large because of the mandatory RGB format textures. The binary that can be downloaded here is a single file executable that contains a static version of GLUT, the 3D world and all the textures in compressed format. I don't have the source of that version anymore, it was a quick modification of the original source.
Download
Download binary: zoo_binary.zip (981.9 KB)
Download source code: zoo_source.zip (3.9 MB)