Honours Year Project – GI implemented using OpenGL

I’ve implemented simple Global Illumination (GI) on a heightmap based terrain written using C/C++ programming language and also OpenGL API.

Here’s a copy of my project abstract :

Using Global Illumination (GI) as an advanced lighting method for terrain generation can be challenging and difficult to implement efficiently. Terrain generation normally involves large complex surfaces consisting of thousands, if not millions of vertices which could really be demanding of hardware if a high level of realism is expected.

This honours project will be based upon using a graphics API to try and implement cheap and efficient GI in a computer generated terrain. OpenGL was chosen as the API as it is a robust open sourced cross platform API. Heightmaps were chosen instead of using procedural terrain generation as the complexity of using the latter method was well beyond the timeframe allowed for this research. The final solution is based on the Spherical Harmonics (SH) Lighting method. This technique is used based on the need of having dynamic light accounted into the final shading step and also taking into account the advantage of computing only low frequency lighting which is a feature in typical landscapes.

The application features a dynamically generated landscape read from a heightmap file with SH lighting methods of various complexity. The shadowed and inter-reflected lighting is quickly pre-computed using a special, heightmap-optimised ray tracer during initial pre-processing step. Final results presents a fully-lit, dynamically shadowed and textured terrain with addition of indirect lighting at a constant, complexity invariant frame rate, which seems to be the ideal solution for the current requirements.

It was initially intended to make use of shader programs to handle the GI but after several attempts, it was found that the shader programs are unable to handle the texture calls and handle the complexity of the algorithm. I have since then resorted to fully code the GI algorithm using the CPU. Although I would have imagined that higher frame rates could be achieved using some of the GPU processing powers, the current frame rates are also acceptable keeping in mind the samples used. This would mean that support for older hardware is also better.

The final program itself has 11 Application Modes. Each showing steps of the algorithm “building up” to the final completed fully lit and textured version. A simple animated water plane was also implemented. This slightly affects the frame rates as the scene had to be rendered twice during run time but on my computer I am still getting an acceptable frame rate of between 28-32 fps.

The algorithm used was a hybrid of Spherical Harmonics and Ray casting.

Below is a flow chart summarising the process flow of the GI algorithm :



Here is a video of the program itself in action. It shows all the available applications modes and also the final app mode with the water plane switched on and off.

Note : If you are using Firefox you must download the Windows Media Plugin for Firefox here to be able to watch videos properly.

[local /wp-content/uploads/2010/05/terraincapture3.wmv demo]

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

error: Protected content
Scroll to Top