Progress update January 2010

Not much has been done so far as I am pretty swamped with courseworks. However, more progress shall be made after the submission of the final coursework which is due soon.

A little update of what has gone on so far in regards to the Honours Project:

  • Got a basic framework up and running. Just trying to tidy up the code a bit so I can “plug-in” the GI algorithms in the future.
  • Have decided on a more focussed approach to project implementation. I am now reading up John Snyder and Derek Nowrouzezahrai’s work on Fast Global Illumination on Dynamic Height Fields and also Fast Soft Self-Shadowing on Dynamic Height Fields. Very interesting read and very good candidate for implementation. Main aim is to get his technique working in my demo framework at the moment.
  • Thinking of some extras such as simple vegatation and water caustics for the demo. I am not sure at this stage if it will be procedural vegetation. Both of them will have GI implemented. I am looking into several methods but at the moment focussing on Instant radiosity
  • I plan to also implement a real time directional light source (sun light) which the user can manipulate.

The topic I have chosen seems to be very involved and requires a lot of techical reading. Next plan is to draft a Gantt chart so I can stick to a more focussed schedule. I will consult my Technical supervisor soon and will update the post as needed.

Here’s a glimpse of Derek and John’s work : cool video


Honours Project Proposal

w fast time has passed it seems… Been very busy with two other courseworks so hardly have time to update blog as frequent as I would have liked it. Anyway, here is my Honours Proposal submission :

This is a copy of the Gantt Chart (click to enlarge) :

and the PDF file can be found here

(The Word document format for the proposal can be found here)


Global illumination (GI) refers to algorithms used to enhance realism using lighting for a 3D scene. This group of algorithms differ to the common techniques used to light a scene because they not only take into account the light emitted from a light source but also the light reflected by objects from this light source. These are called direct and indirect illumination respectively. Common examples of algorithms used in GI are ray tracing, radiosity, ambient occlusion, photon mapping and image based lighting. Sometimes hybrids of these examples are also used to produce a more realistic yet efficient result. [Wikipedia] Generally though, ray tracing is an offline or a non-real-time method that is computationally extremely expensive. On the contrary rest of the methods mentioned above are very efficient and can be cleverly implemented in real-time.
Scenes rendered using Global Illumination algorithms are more photorealistic. Lighting is a very important factor in photorealistic rendering. The physical processes that form the basis of photorealistic rendering are light-material interaction, light transport and also the psychophysical aspects of the human visual system. [Dutré, et al., 2006]
However, GI could be very computationally expensive to implement, especially in real time and dynamic applications. In the past, high quality realistic scene could only be rendered offline and that also takes a considerable amount of time to achieve. Another alternative is to produce highly inaccurate and low quality results. [Stokes, et al., 2004]
Recently, computer generated 3D terrain is becoming more popular in various applications. Games ranging from first person shooter to strategy implements some form of terrain generation. Realistic computer generated terrain is also used in advanced mapping software and also in simulators used to train pilots and military personnel. A very good example is a 3D geospecific terrain created to train soldier fighting in Afghanistan. Created using proprietary software called the “Virtual Reality Scene Generator” developed by MetaVR, it could generate over 9,600 square kilometres of geospecific landscape with 500 accurately modelled buildings. According to MetaVR’s developers, “Unlike the simplified, flattened terrain used to simulate urban environments in most image generators and video games, MetaVR’s Afghan village is set within mountains, complex terrain of varying elevation, and cave complexes enabling realistic training scenarios for operations in mountainous villages.” [metavr, 2009]
To achieve a level of realism required for some applications of which include terrain generation, GI techniques could be considered. For real time terrain generation, the visual complexity is due to its lighting and not just the geometry. Lighting calculation when the whole generated terrain is static is relatively easy since most of the lighting calculations could be done before rendering. However, when considering a more dynamic environment, or even real time applications, applying GI techniques could also be challenging. [Mitchell, et al., 2002]
It will be interesting to research into methods to push the boundary on how realistic a terrain can be rendered in real time. I am also personally very interested in graphics programming especially when it involves games. I hope to find a cheap and effective method of greatly improving the visual realism in games to add even more immersion.
With the advancement of GPU technology, the door opens to a multitude of new possibilities in graphics rendering. Traditionally, generated terrains were limited to heights fields that are generated by CPU and then rendered by the GPU. [Geiss, 2007] It is now possible use the raw processing power of the GPU to render a much more complex and realistic procedural terrain. Realistic lighting is also one of the biggest issues in real-time terrain generation. A lot of games that features outdoor scenes such as MMOs will benefit from this research.
This honours project fully meets the course requirements as it requires both technical writing skills and also programming skills. Most of this project requires in-depth technical and background reading. Proper project management and planning skills are also required to ensure that the project will have some accomplishments. Furthermore, research into graphics programming is very relevant to the course as it is a vital part of the computer gaming industry. Appropriate research and testing will also be carried out and an analysis would be done to cover any problems faced during the course of the project.
Research Topic
The GI techniques will be applied to a framework demo which is a scene of a 3D world consisting of a procedurally generated terrain coded using the C++ language and the OpenGL API. There would also be implementation of vegetation, simple water effects and a dynamic directional light representing the sun in the demo. Fractal methods such as midpoint displacement and fault line algorithm will be used to generate terrain’s height field.
The demo would most probably feature procedurally generated height field geometry with a few non-height field elements such as vegetation and some bodies of water. A simple directional lighting representing the sun with some low-frequency environmental lighting will also be added.
Rendering water is relatively easy but simulating it requires advanced mathematics and physics. Interactive fluid dynamics rendering and real-time particle based fluid simulation using Lagrangian and Hamiltonian systems are a good source for interactive fluid dynamics rendering and real-time particle based fluid simulation.
However, again due to time constraints, considerations will also be made to generated simple water with primitive animation and reflections as discussed in Polacks’s book, Focus on 3D Terrain Programming [Polack, et al., 2003]. These types of simple methods are mostly used in real-time games and applications due to their high visual quality and extremely fast rendering speed. To further enhance realism, real-time caustics can be implemented.
The advantage of real-time procedural terrain generation is that there is no requirement of pre-modelled 3D mesh or a 2D height map. Procedurally generated terrains also have an outstanding visual quality and are extremely fast, hence perfectly suited for real-time applications. Soft shadows will be implemented in the terrain. Soft shadows differ from the more common hard shadows because their penumbras lighten gradually as the shadow caster recedes from the receiver. [Fast Soft Self-Shadowing on Dynamic Height Fields, 2008] This will result in a greatly improved shadowing effect.
To handle the GI on the terrain, the aim is to try to implement work done by Derek Nowrouzezahrai and John Snyder to the demo. Their work covers a real-time method for rendering GI effects that can be applied to a large area with environmental lights. Their method involves handling indirect lighting and non-diffuse surfaces. [Fast Global Illumination on Dynamic Height Fields, 2009] From reading the paper it seems that their technique is effective and will be realistic to be implemented for the project.
Another method that will be looked into is “Lightcuts”. [Lightcuts: A Scalable Approach to Illumination, 2005] Simply speaking, it is a framework that approximates global illumination and several of its subset techniques. It can be applied to a dynamic range of situations and the output quality is very good in the open environments when simulating daylight.
Research Question

“What are the techniques involved in real time lighting effects for procedurally generated terrain?”

Comprehensive literature review into GI techniques would be researched to further understand about GI in real time applications such as terrain generation. A good understanding of the topic at hand is very important to ensure that the project can be carried out smoothly. I will also draft out milestones to monitor project progress and make any necessary adjustments to ensure that the main objectives of the project could be completed on time. I will try to create a Gantt chart to help me keep track of the project.
The methods proposed by Derek Nowrouzezahrai will be focussed on and implemented in the framework demo because there is a lower chance of failure as Derek has already tested it on an open terrain.
As there’s always chances of failure in the proposed method, I have decided to also look into the “Lightcut” method mentioned as a backup plan. This is to ensure that I will have some submissible work at the end of the project implementation period.
The real time water simulation and animation will have a lower priority and the simplest method of implementation will always be chosen. However I believe with simple reflections/refractions and animation, it will be adequate to look realistic. As for the vegetation, I will randomly place billboard trees and grass on suitable and realistic position on the terrain. For simplicity the vegetation will be non-animated.
The main resource requirement for this project is a lot of relevant literature. A C++ debugger and compiler such as Microsoft’s Visual Studio 2005 and the OpenGL API is also a basic required for the software side while the hardware requirement would be a decent computer able to handle running the demo. At the moment, the computers available in the university’s laboratory should be adequate.
Project Evaluation
As the main bulk of the project will be on research, a good way of evaluating the outcome is through the produced dissertation. The results of the literature review and comparison of possible GI implementations and in-depth analysis of the research question will be included along with the dissertation.
The demo would also aid the evaluation process as it will show the ideas behind the project visually. At the moment it is planned to include a simple Frames per Second (FPS) and Polygons per Second (PPS) counter in the demo to try to show the efficiency of the technique employed.
Possible Issues
GI is a very wide and complicated topic and implementing GI on procedurally generated terrain is also a very challenging task. Thus there could be some issues faced along the way. Below is the list of issues that could probably be encountered during the course of the project:
1) Time constraint is the most probable issue as well so a very rigid schedule has to be drafted and followed. I will plan regular meetings with my technical supervisor to ensure that my work is feasible to be carried on.
2) Longer than planned timeframe required to implement GI on extra features such as vegetation and water bodies. Using static vegetation could minimise problems faced.
3) Performance penalty that could occur as terrain generation with GI implementation uses a lot of resources from the CPU for crunching algorithms and also requires a decent GPU to handle rendering. Proper testing will have to be done to avoid any bottlenecks and “mini” optimisations carried out at every stage to ensure that the final demo will still run decently. If there are too much problems faced and not enough time to properly rectify it, the features would be left out accordingly.
4) The computers in the university laboratory might not be able to run the demo. Constant testing in the universities laboratories will be carried out and if the final demo can’t run on the university’s computer I will try to request a machine that is capable to or try to bring my own computer.
1. Dutré, Philip, Bala, Kavita and Bekaert, Philippe. 2006. Advanced Global Illumination : Second Edition. Massachusetts : A K Peters, Ltd., 2006. ISBN.
2. Fast Global Illumination on Dynamic Height Fields. Nowrouzezahrai, Derek and Snyder, John. 2009. 4, s.l. : Eurographics Symposium on Rendering, 2009, Vol. 28.
3. Fast Soft Self-Shadowing on Dynamic Height Fields. Snyder, John and Nowrouzezahrai, Derek. 2008. s.l. : Eurographics Symposium on Rendering, 2008.
4. Geiss, Ryan. 2007. Generating Complex Procedural Terrains Using the GPU. [book auth.] Hubert Nguyen. GPU Gems 3. Massachusetts : Pearson Education, Inc., 2007.
5. Lightcuts: A Scalable Approach to Illumination. Walter, Bruce, et al. 2005. s.l. : ACM SIGGRAPH 2005 conference proceedings, 2005.
6. metavr. 2009. MetaVR announces new Afghanistan 3D Terrain and the Release of Virtual Reality Scene Generator Version 5.5. Virtual Reality Resources. [Online] 2009.
7. Mitchell, Kenny and Hoffman, Naty. 2002. Methods for Dynamic, Photorealistic Terrain Lighting. [book auth.] Dante Treglia. Game Programming Gems 3. Massachusetts : Charles River Media, INC., 2002.
8. Polack, Trent and LaMothe, André. 2003. Focus on 3D Terrain Programming. Ohio : Premier Press, 2003. ISBN.
9. Stokes, William A, et al. 2004. Perceptual Illumination Components: A New Approach to Efficient, High Quality Global Illumination Rendering. s.l. : ACM Transactions on Graphics (Proc. of SIGGRAPH) 23, 3,742–749, 2004.
10. Wikipedia. Global Illumination. Wikipedia. [Online]
11. Dickheiser, Michael. 2006. Game Programming Gems 6. s.l. : Charles River Media Price, 2006.
12. Nguyen, Hubert. 2007. GPU Gems 2. Massachusetts : Pearson Education, Inc., 2007.
13. Real-Time Caustics. Wand, M. and Straßer, W. 2003. 3, s.l. : EUROGRAPHICS, 2003, Vol. 22.
14. Shah, Musawir A. and Pattanaik, Sumanta. 2005. Real-time Caustics Rendering. [Online] 2005.
15. Shastry, Anirudh.S. 2005. Soft edged shadows. [Online] 18 January 2005.
16. Slater, Mel, Steed, Anthony and Chrysanthou, Yiorgos. 2002. Computer graphics and virtual environments : From Realism to Real-time. Essex : Pearson Education Limited, 2002.
17. The Terrain Rendering Pipeline. Roettger, Stefan and Frick, Ingo. 2002. s.l. : In Proc. of East-West Vision, 2002.


RQ Workshop

Below are the answers provided to the RQ Workshop worksheet (Worksheet 4)

1) What is the name of this module, how many credits?
CS1004 – Honours Project Planning & Reporting

2) Your technical supervisor, how many times have you met?
Only met him once but the first meeting was very production, it gave me a lot of new ideas for the research question.

3) How frequently do you update your blog?
Once a day, sometimes one every 2-3 days depending on how much progress I made. I would update my Project Diary more often than the blog as it’s informal and I could jot down rough ideas.

4) Have you included both you worksheets in your blog?
Yes, I have.

5) Have you made sure readers can leave comments and you can annotate the blog entry based on these feedbacks?
Yes, I have.

6) Have you subscribed to any game related forum and posted your RQ research ideas and got feedback?
I have posted on the GameDev forums asking for people’s comments but so far it doesn’t have any replies yet.

7) Have you looked for additional feedback other than the ones I’ve prescribed?
Not at the moment.

8) What backup procedure have you implemented?
I have used a program called Blogger Backup Utility to backup the blog in XML format so I can restore it if the blog is accidently delete. I have also saved the whole page as html so that I will still have the pictures on the blog.

9) How long do you spend for your Honours project activities?
To be honest I haven’t been really spending enough time during the first few weeks of the project. I have now scheduled my activities better so I am spending an average of 2 hours a day (excluding weekends) on the project.

10) What is your RQ?
What are the techniques involved in real time lighting effects for procedurally generated terrain? However the research question might be slightly tweaked later on for the final proposal submission.

11) Why is it important?
It will help me understand more about lighting in graphics programming.

12) How will you answer it?
First step is a lot of reading. I must source all the related books and papers to understand more and finally focus on the final method of approach.

13) So what will be your measure of success?
I will be happy if I can implement a demo that shows a photorealistic rendition of a procedurally generated terrain.

14) What will be the significance of what you have done?
I hope that this will give me an opportunity to enrich my CV and to help me seek employment that hopefully will specialize in the field of graphics programming.


New Inspiration

First meeting with technical supervisor, Matthew Bett taken place today. The meeting was very productive and the outcome was excellent as the discussions fuelled ideas and probably a new direction for the project.

Previously, simpler lighting techniques were considered such as height based lighting, slope lighting and lightmapping algorithms. Currently, the consideration of rendering a High Definition Range Imaging (HDRI or just HDR for short) terrain/scene contained within a skybox is considered. Basically HDR renders a scene using  lighting calculation using a larger dynamic range as compared to traditional methods. This will greatly enhance the realism on the scene.

The challenge now is to consider how to handle materials in the scene which consists of mainly the terrain mesh. The terrain would also be largely static so that could be a challenge to bring out the HDR qualities. The idea of using a HDR Environment map as the light source and reflection map is being investigated at the moment as it is not sure how well it could be implemented in the application.

Below is an example of how HDR can greatly boost the realism of a computer generated scene :

Example from the popular PC game Crysis
Complex 3D models won’t be featured (or will only be featured minimally) in the demo so most of the HDR lighting will be done on the terrain itself. At this stage it is not yet certain of the real time performance and also the chance of procedurally generating such a scene.
Soft Shadows – This is also considered to be implemented in the scene
Changing of primary light source position/direction and also consideration of auxillary light sources
This is yet another problem that has to be researched into.
There’s seems to be abundant techniques out there for photorealistic computer graphics rendering. The next aim is to pick out suitable ones for the research.

Cloud Shadows?

I found another cool example that I would wish to implement in my demo – Cloud shadows on terrain. I think it would be very cool especially if the shadow is smooth and follows the curvature of the terrain surface. I wonder what happens if shadows overlapped though, ie the shadow from clouds with the shadow from the terrain (shadows generated by higher “cliffs” onto flatter terrain).

Anyway, here’s the Youtube video :