Assignment #2

3D Fractal Landscapes using the Diamond Square Algorithm

Due: We. Sept. 22nd, 2pm. EXTENDED TO SEPT. 29th, 2pm. 2 bonus points for finishing until sept. 22nd !
Teamwork highly recommended
Score: 10 points (+2 bonuspts.)

Creating the Terrain

Create a heightfield terrain map in C++ using the Diamond Square Algorithm as presented in the lecture. As a help i programmed a MATLAB version (did i tell you that MATLAB is one of the most convenient programming languages out there ?), which you can download and analyse. If you understood what's going on there, then you simply have to translate it to C++ . Watch the index behaviour of MATLAB: MATLAB starts indexing matrices (=arrays) with 1 instead of 0.
The MATLAB function creates a fractal terrain as a matrix, you can display this matrix using 'plotMatrix3d.mat' also delivered here. If you want to see some terrains, simply type into MATLAB:

plotMatrix3d; axis equal;

and you'll be excited, i hope.

HERE is the MATLAB code for the terrain
HERE is the MATLAB code for the display

This is an example terrain created by the program:

Displaying the Terrain

You display your terrain using OpenGL. We didn't talk too much about OpenGL so far, so i decided to give you the whole framework to show a terrain heightfield as C++ program. Your task is still to CREATE the values of the heightfield though, using the approach described above.

What is delivered ?

The Visual Studio Project to show the heightfield is HERE
The GLut files are here

If everything went right, you should be able to compile the program, the result:

We will build a game using this terrain in the upcoming assignments, so don't faint on this one !