Skip to content

TerrainZigger: A procedural 3D terrain generator and visualizer written in Zig using Raylib

License

Notifications You must be signed in to change notification settings

JosefAlbers/TerrainZigger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TerrainZigger

TerrainZigger is a 3D terrain generator written in Zig using the Raylib library. It creates procedurally generated landscapes with dynamic water features, offering an interactive 3D visualization.

TerrainZigger

Features

  • Procedural terrain generation using Fractional Brownian Motion (FBM)
  • Real-time 3D rendering with Raylib
  • Interactive camera controls for exploring the terrain
  • Dynamic water level adjustment
  • On-the-fly terrain regeneration
  • Customizable terrain parameters

Prerequisites

To build and run TerrainZigger, you'll need:

Building and Running

  1. Clone the repository:

    git clone https://github.com/JosefAlbers/TerrainZigger.git
    cd TerrainZigger
    
  2. Build the project:

    zig build-exe terrain_zigger.zig -lc $(pkg-config --libs --cflags raylib)
    
  3. Run the executable:

    ./terrain_zigger
    

Controls

  • R or Right Mouse Button: Regenerate terrain
  • Left Mouse Button: Rotate camera
  • Mouse Wheel: Zoom in/out
  • Z: Reset camera
  • , (Comma): Decrease water level
  • . (Period): Increase water level

Customization

You can adjust various parameters in the terrain_zigger.zig file to customize the terrain generation:

  • TERRAIN_SIZE: Changes the size of the terrain grid
  • INITIAL_WATER_LEVEL: Sets the initial height of the water plane
  • CUBE_SIZE: Modifies the size of individual terrain cubes

Feel free to experiment with the fbm function parameters in generateTerrain to create different terrain styles.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is open source and available under the MIT License.

Acknowledgments

  • Terrain generation algorithm inspired by Perlin Noise
  • 3D rendering made possible by Raylib

Happy terrain generating! 🏞️