Warning
Work in Progress Building to web currently unsupported.
This is a WIP in-depth exploration of terrain generation that I am developing in C++ using the WebGPU graphics API.
- Camera Controller (zoom, click to drag, etc.) ✅
- Dev GUI ✅
- Generate plane meshes of configurable sizes ✅
- Adjust mesh using noise as a heightmap
- Explore Value, Perlin, Simplex, and Cubic noise varieties. ✅
- Sample multiple noises at once (Fractional Brownian Motion) ✅
- Adjust noises individually including scale, amplitude, etc.
- Color map the terrain based on height, steepness, etc.
- Dynamically load and unload chunks of terrain
- Dynamically adjust level of detail a quadtree, clip maps, etc.
- Cull the terrain using frustum and occlusionS
- Post-processing effects, atmosphere, lighting, skybox, etc.
- Vegetation
- Water
GLFW
: Window creationGLFW3 WebGPU
: Wrapper for GLFW to support cross-platform WebGPUWEBGPU
: WebGPU distributionWGPU-Native
: Native interface towgpu
Rust library developed for FirefoxDawn
: Google's WebGPU implementation developed for Chrome in C++
WebGPU-Cpp
: WebGPU C++ WrapperImGui
: Lightweight dev guiGLM
: Math librarySTB
: Lightweight image loading/saving (Included)
All of these are available through git submodules. Instructions are below.
cmake
: 3.20+- a modern C++20 compiler: todo update versions:(
gcc-8
,clang-6.0
,MSVC 2017
or above) Emscripten
: (Required for building to web)
Note
On Windows I was unable to build and run using any build system except MSVC. MinGW and Cygwin could not track some specific Windows SDK headers (e.g. DirectX Compiler) among other issues. WSL is also unsupported as far as I can tell as well. YMMV
-
Clone this project using git.
-
From the root of this project update all the submodules with
git submodule update --init --recursive
. -
Follow the command-line instructions below:
cmake . -B build ${OPTIONS} cmake --build build
Use -G ${GENERATOR}
to use a specific build system (e.g. "Unix Makefiles"
, "Visual Studio 17 2022"
, etc.).
Use -D WEBGPU_BACKEND=${BACKEND}
to use a specific WebGPU platform (e.g. DAWN
or WGPU
). Defaults to WGPU
.
Execute either ./build/app
(linux/macOS/MinGW) or build/Debug/app.exe
(MSVC).
- Clone this project using git.
- From the root of this project update all the submodules with
git submodule update --init --recursive
- Open the project in an editor that directly supports CMAKE files.
Within Build, Execution, Deployment
-> Toolchains
, drag Visual Studio
to the top of the list to make it the default option.
Next, navigate to Build, Execution, Deployment
-> CMake
, selecting your corresponding toolchain and generator. Append to the CMake options:
field: -D WEBGPU_BACKEND=${BACKEND}
where ${BACKEND}
is either WGPU
or DAWN
.
Tip
A second CMake profile may be created to build to both platforms.
Reload your CMake project.
build
: Generated build files and binary application.data
: Screenshots and other data.docs
: Personal notes,documentation, and examples.external
: External dependencies (e.g. git submodules).resources
: Project resources such as textures, sounds, music, etc.src
: Source code