This program was part of my school presentation on procedural terrain generation. It shows a variety of methods for generating terrain and explores how they work.
- Click/Space/Enter/Right Arrow - to switch between terrain types (this is used as part of a presentation)
- O - explore the current terrain type
- When exploring:
- WASD to move
- Hold click and drag to look around
- Scroll - zoom in/out from target point
- R - regenerate terrain with new random seed
This program takes a heightmap and displays it on a triangle mesh. y = sin x + sin z creates a 2D sine wave. Squaring it makes higher areas steeper and lower areas flatter. Multipling this by a random value means the magnitude of randomness is increased at larger heights, making higher up areas more jagged. Taking the random values from before and interpolating between them (pictured visually with a blur effect) gives us perlin(like) noise, creating much more interesting looking terrain.
