Procedural Terrain Generation

Terrain generated using multi-octave Perlin noise with height scaling and depression dampening for smoother valleys. Please note frame rate may appear lower due to gif format.

This project focuses on procedural terrain generation using Perlin noise in GLSL. The generated terrain is visualized with Phong shading and emissive color blending, creating realistic landscapes with mountains, valleys, and natural lighting.

The terrain is generated dynamically using Perlin noise for height variation. Perlin noise provides smooth, natural-looking gradients, making it ideal for terrain synthesis. The final shading model applies Phong lighting to create depth and realism.

1. Generating Perlin Noise

Perlin noise is used to generate a smooth heightmap for the terrain. This is done in three steps:

• Hash function: Generates pseudo-random gradients for noise computation.

• Perlin noise function: Computes interpolated noise values based on surrounding grid points.

• Octave synthesis: Combines multiple layers of Perlin noise at different frequencies to create complex terrain.

2. Computing Terrain Height

The terrain height is calculated using octave synthesis, with different transformations applied for varied landscapes:

• Steep mountains -> sqrt(noise_octave(v, num))

• Jagged peaks -> exp(noise_octave(v, num))

• Rolling hills -> sin(noise_octave(v, num))

3. Calculating Surface Normals

To achieve proper shading, we compute surface normals using the cross product of height differences at nearby points. This allows accurate Phong shading based on light reflections.

4. Phong Shading

Phong shading simulates realistic lighting with three components:

• Ambient lighting: Simulates indirect light.

• Diffuse lighting: Simulates light spreading across surfaces.

• Specular lighting: Creates highlights based on shininess.

5. Terrain Coloring

The terrain color is blended based on height.

This project demonstrates how Perlin noise, Phong shading, and procedural texturing can be combined to create realistic terrain in GLSL. By synthesizing noise octaves, computing surface normals, and applying dynamic lighting, we achieve natural-looking landscapes with smooth transitions between different terrain types. The result is a fully procedural, real-time-rendered terrain that can be customized for various environmental effects. This approach is widely used in game development, simulations, and computer-generated landscapes, providing an efficient way to create detailed 3D worlds without requiring pre-modeled assets.

Terrain generated using fractal Brownian motion (fBm), summing Perlin noise with exponentially decreasing amplitude and increasing frequency for natural detail.

Tags:

Leave a comment