An open API service indexing awesome lists of open source software.

https://github.com/gyakobo/terrain-generation

A procedural terrain generation project built with C++ and modern OpenGL. This repository implements noise-based algorithms and real-time rendering techniques to create realistic and visually stunning terrains.
https://github.com/gyakobo/terrain-generation

3d-graphics 3d-graphics-engine c c-plus-plus glsl perlin-noise random shading terrain-generation tesselation

Last synced: about 1 month ago
JSON representation

A procedural terrain generation project built with C++ and modern OpenGL. This repository implements noise-based algorithms and real-time rendering techniques to create realistic and visually stunning terrains.

Awesome Lists containing this project

README

          

# Terrain-Generation

![image](https://img.shields.io/badge/C-00599C?style=for-the-badge&logo=c&logoColor=white)
![image](https://img.shields.io/badge/C%2B%2B-00599C?style=for-the-badge&logo=c%2B%2B&logoColor=white)
![image](https://img.shields.io/badge/CMake-064F8C?style=for-the-badge&logo=cmake&logoColor=white)
![image](https://img.shields.io/badge/windows%20terminal-4D4D4D?style=for-the-badge&logo=windows%20terminal&logoColor=white)

Author: [Andrew Gyakobo](https://github.com/Gyakobo)

A procedural terrain generation project built with **C++** and modern OpenGL. This repository implements noise-based algorithms and real-time rendering techniques to create realistic and visually stunning terrains. The project leverages **ImGUI** for an interactive user interface, **GLEW** for OpenGL extensions, and **GLSL** for shader-based rendering.

---

https://github.com/user-attachments/assets/53823b99-ff5b-48bf-9746-29d1130756fa

## Features

- **Noise-Based Terrain**: Implements Perlin or other procedural noise algorithms for smooth, natural terrains.
- **Real-Time Rendering**: Powered by OpenGL and GLSL shaders for efficient 3D visualizations.
- **Interactive Controls**: Modify terrain parameters dynamically using the **ImGUI** interface.
- **Customizable Settings**: Adjust resolution, noise parameters, and rendering modes in real-time.
- **Camera Controls**: Navigate the terrain using a built-in camera system.

---

## Prerequisites

Ensure your system has the following installed:

- A C++ compiler (e.g., GCC, Clang, or MSVC)
- OpenGL 3.3+ compatible GPU and drivers
- [GLEW](http://glew.sourceforge.net/): OpenGL Extension Wrangler
- [GLFW](https://www.glfw.org/): For creating windows and handling input
- [ImGUI](https://github.com/ocornut/imgui): For user interface
- [GLM](https://github.com/g-truc/glm): For mathematics (optional, but recommended)

---

## Getting Started

### 1. Clone the Repository

```bash
git clone https://github.com/Gyakobo/Terrain-Generation.git
cd Terrain-Generation
```

### 2. Build the Project

For Linux users you can run the program with the following:

```bash
sudo g++ -std=c++11 main.cpp src/*.cpp src/imgui/* -o main -lGLU -lglfw3 -lX11 -lXxf86vm -lXrandr -lpthread -lXi -ldl -lXinerama -lXcursor -lGL -lGLEW

# If the previous command didn't work out then please run the following where I specifically manually added all the necessary IMGUI dependencies
sudo g++ -std=c++11 main.cpp src/*.cpp src/imgui/imgui.cpp src/imgui/imgui_impl_glfw_gl3.cpp src/imgui/imgui_demo.cpp src/imgui/imgui_draw.cpp -o main -lGLU -lglfw3 -lX11 -lXxf86vm -lXrandr -lpthread -lXi -ldl -lXinerama -lXcursor -lGL -lGLEW

sudo ./main
```

Alternatively, please just run the [build.sh](./build.sh) after you go it executable permissions: `sudo chmod +x build.sh`

For Windows users you should just:

```bash
mkdir build && cd build
cmake ..
make
```

## Methodology

So this should be the simple usage criteria:

* **Modify Terrain Parameters**: Use the ImGUI panel to adjust noise parameters (scale, octaves, persistence) or change rendering options.

* Camera Controls:
* W/A/S/D: Move forward/left/backward/right.
* Mouse Drag: Rotate the camera.
* Scroll: Zoom in/out.

* Export Screenshots: Save a snapshot of the current view (if implemented).

## Project Structure

```
Terrain-Generation/
├── src/ # Source code
│ ├── main.cpp # Entry point
│ ├── renderer.cpp # Rendering logic
│ ├── terrain.cpp # Terrain generation logic
│ ├── shaders/ # GLSL shader files
├── include/ # Header files
├── resources/ # Textures, configurations
├── CMakeLists.txt # Build configuration
└── README.md # Project documentation
```

## Future Features

- [ ] Add support for advanced noise algorithms like Simplex or Worley noise
- [ ] Implement texture mapping for more detailed terrains
- [ ] Add water rendering with reflection/refraction effects
- [x] Simulate dynamic lighting and shadows
- [ ] Support terrain export as heightmaps or 3D models
- [ ] Add more textures of maybed even a height-map
- [ ] Generate texture wrappers(images) based on the features of the shape

## License
MIT