This application demonstrates the use of Simplex Noise both on the CPU and GPU to procedurally generate terrain, textures and normal maps. Everything in the scene is created at run time – no textures or models are loaded in at all. The scene was rendered using OpenGL, with Lighting, material and multi-texturing effects applied through the use of GLSL shaders, using a simple but flexible modular framework I built throughout the project.
Simplex Noise is Ken Perlin’s updated version of Perlin noise. While generally less well known, it has a number of advantages over classic Perlin Noise, for example being visually isotropic, being faster to calculate at higher dimensions and having a lower computational complexity in general, with far fewer multiplications required. In common with Perlin Noise, Simplex noise will produce the same output given the same input values, and by considering functions such as taking the absolute values of the noise produced a range of effects can be created.
Colours, Lights and Textures
Although the terrain is given colour values as it morphs, all the textures were created and applied on the GPU. Both textures (created using fractal Brownian Motion and Simplex Noise) and materials vary according to the height of the terrain – for example you can see that the sand has a far higher shininess and specular material component than the grass, and is also normal-mapped.
The lighting effects are all written in GLSL and aim to emulate fixed pipeline lighting, but on a per-pixel basis.
The water simulation is created from the numerical solution of a partial differential wave equation. While it isn’t shown in the demo, altering the water at any point will effect the rest of the simulation – for example lowering a point to represent a stone being dropped would cause ripples. The calculations for this are performed on the CPU on a seperate thread, as the change in time for each frame must be constant for the simulation to be correct.
Although not seen in the video, the controls for a first person and third person are shown on-screen within the application. New terrain can be generated using the ‘N’ key, and the camera mode can be selected using keys ’1′ and ’2′.