Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terrain-Generation

image image image image

Author: Andrew 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.


terrain_generation.mp4

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: OpenGL Extension Wrangler
  • GLFW: For creating windows and handling input
  • ImGUI: For user interface
  • GLM: For mathematics (optional, but recommended)

Getting Started

1. Clone the Repository

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:

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 after you go it executable permissions: sudo chmod +x build.sh

For Windows users you should just:

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
  • 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

About

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.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages