Procedural Landscape Matthew O'Toole CPSC 314 Project 3 The goal for this tutorial is to develop a randomized but realistic world, including infinte terrain, animated sky, and simple water, with a good fps so that the world can be interacted with in real time. To run the program: 1. Set library path (should be configured to user's directory) > setenv LD_LIBRARY_PATH {$LD_LIBRARY_PATH}:/.autofs/linux/home/f/f0k3/cs314/proj3/ 2. Compile the program > g++ -L./ -lGLEW -lGL -lglut *.cpp -o main 3. Run the program > main Controls: Use the mouse to point camera. Left click selects polygons. W - Move forward S - Move backward A - Straft left D - Straft right E - Toggle sky R - Regenerate terrain T - Increase height map smooth factor Y - Decrease height map smooth factor U - Decrease cloud cover I - Increase cloud cover O - Decrease cloud sharpness P - Increase cloud sharpness 1 - Toggle wireframe 2 - Toggle render mode 3 - Toggle geomorphing 4 - Toggle frustum culling 5 - Toggle freeze frustum 6 - Toggle clouds octaves 7 - Toggle sky shape 8 - Toggle exponential function for clouds 9 - Decrease height 0 - Increase height - - Decrease error tolerance + - Increase error tolerance ESC - Exit Documentation: The advance functionalities of my program is the SOAR algorithm (by Lindstrom) for continuous level of detail of a wrapping fractal generated terrain and the procedural generation of real-time clouds with Perlin Noise. The SOAR algorithm is an LOD (level of detail) algorithm which works by splitting a terrain (which currently must be of size n * n where n = 2^i for some integer i) into smaller and smaller polygons based on the location of the camera and the error in the terrain. The implementation of the SOAR algorithm also takes into account the popping effect where polygons pop into their new location once being refined. To lesser this effect, geomorphing is added to the algorithm so that vertices interpolate between the previous level and the current level once refined. As mentioned before, frustum culling is also applied so that terrain is not refined if that part of the terrain cannot be seen. To take advantage of the wrapping of the terrain, I was able to arrange the indexing of the SOAR algorithm to reduce overhead. (For non wrapping terrains, which are of size (n + 1) * (n + 1), Lindstrom's simplified indexing scheme is not optimal where there is unused location in the SOAR tree.) The terrain is randomly generated using the diamond-square method, and the textures for the terrain are procedurally generated based on height. Furthermore, to get a little more detail on the terrain, a MIPmapped detail textures is combined to the main terrain texture. Lindstrom's paper for this LOD algorithm is available here: http://www.gvu.gatech.edu/people/peter.lindstrom/papers/vis2001a/paper.pdf The clouds are generated using a maximum of four levels of perlin noise. Perlin noise is generated by smoothing white noise. Then, each "octave" of noise is then added together at different scales and intensities. The result is similar to that of a cloud. Each octave is interpolated between two perlin noise textures to simulate cloud animation. To be able to simulate clouds real time, the extension GL_EXT_env_combine to take advantage of hardware interpolation between textures. Note that GL_ARB_multitexture is also required. The clouds are also blended with a fog which makes the clouds seem to vanish near the horizon. The sky can also be displayed as a dome (nicest) or on a flat plane (fastest). Since currently the clouds take up most of the sky, the extension GL_ARB_imaging is used to apply an exponential functions to the clouds to get a nicer effect by precomputing a look-up table for the exponential function. Note that although this works nicely and everything is done on hardware, the FPS dropped to 10 fps on the undergraduate machines in CICSR 011. The website describe use of Perlin Noise is available here: http://freespace.virgin.net/hugo.elias/models/m_perlin.htm The website also describes use of Perlin Noise with clouds, which is available here: http://freespace.virgin.net/hugo.elias/models/m_clouds.htm In addition, there is volumetric fog for the water, and the water textures move to simulate simply water flow. Picking is used to locate different levels of the polygons in the LOD terrain. For minor references, the following websites have been used as references: http://www.ugrad.cs.ubc.ca/~cs314 http://www.lighthouse3d.com/ http://nehe.gamedev.net These references were used mostly for GLUT related problems, picking, multitexturing, mipmapping, and frustum culling. Furthermore, the code to load textures was taken directly from the solaris download for lesson 7 at nehe.gamedev.net.