Procedural Landscape Generation and Visualisation
This project generates and visualises a procedural landscapes. It includes adjustable water level and flying through the world. It generates the terrain using Perlin noise and creates the graphics using OpenGL and custom shaders.
You may click on any images to enlarge them.
Landscape Generation
Octave Perlin noise is a technique by which multiple layers of perlin noise layers at different scales are combined to form large scale terrain combined with small scale details.
Octaves
The number of octaves stacked together affects how detailed the resulting terrain will be. Increasing the number of octanes used with increase terrain generation time but not the rendering time (per frame).
Vertex count
Vertex counts directly impact rendering time. The higher the vertex count, the more natural the result but slower the rendering time.
Visualisation
Once the world is generated, it is visualised by transforming the vertices in world space to projected viewport space and paining each pixel by combining the vertex world space coordinates, height and textures.
It uses a z-buffer to depth sort fragments, and the alpha channel to to allow for the transparent water.
Back-face culling is enabled to improve performance.
Shaders
Vertex shaders perform the transformations on the vertices to move them from object space, to world space, to view space to projected view port space.
The fragment shader then receives interpolate coordinates and values from the vertex shader to paint each fragment. After this process the fragments closest to the camera become pixels in the final image.
The interpolation for fragments between vertices can be set to linear or nearest where the values of the closest vertex are used. I preferred the visual style obtained by using the nearest values.
Texture
To give the terrain some surface texture, some random grey scale noise is generated and projected top down onto the map. The noise is blended with the original colour values. A noise level of 3% appeared to give the world some surface texture without obscuring it.
Implementation Details
This project is implemented in Java using the Lightweight Java Game Library 3 (LWJGL) that binds the OpenGL APIs to the Java language.