Procedural content generation is one of the most popular topics in computer graphics and allows us to generate data using the power of algorithms and minimise efforts spent on editing.
SuperTerrain+ is a built-from-scratch procedural terrain engine and real-time renderer started as my personal project in July, 2020 and later become my undergraduate dissertation project. As of current I am using it as a low-level procedural generation and rendering framework for my PhD research.
SuperTerrain+ provides a low-overhead, extendible and flexible interface, demonstrates application of modern programming and rendering techniques; with the help of extensive in-source documentations, this is also a great place for learning.
- Improved simplex noise
- Hardware tessellation
- Continuous level-of-detail
- Multi-threaded heightfield generation
- Free-slip particle-based hydraulic erosion
- Programmable static/runtime-compiled pipeline
- Biome generation
- Multi-biome heightfield generation with smooth transition
- Rule-based biome-dependent texture splatting with smooth transition
- Adaptive distance-based texture scaling
- River and lake generation
- Come up with a nice plan for this challenging topic
- Volumetric cloud
- Procedural object placement
- Procedural animated grassland generation
- Procedural tree generation
- Procedural rock generation
- Procedural sky rendering
- Atmospheric scattering
- Aerial perspective
- Seasonal effect
- Starfield
- Aurora
- Deferred shading
- Post-processing
- Filmic tone mapping
- Gamma correction
- Auto-exposure
- Shadow mapping
- Simple shadow mapping for spotlight
- Cubemap shadow mapping for point light
- Cascaded shadow mapping for directional light
- Ambient occlusion
- Screen-space ambient occlusion
- Horizon-based ambient occlusion
- Anti-aliasing
-
Multi-sample anti-aliasing - Fast-approximate anti-aliasing
- Morphological anti-aliasing
- Temporal anti-aliasing
-
- Multiple lights
- Ambient light
- Directional light
- Point light
- Spotlight
- Water rendering
- Procedural water wave animation
- Screen-space reflection
- Screen-space refraction
- Fresnel effect
- Caustics
- Underwater crepuscular rays
- Procedural weather effect
- Reflection
- Refraction
- Shadow
- Ambient occlusion
- Global illumination
- Caustics
- Reversed depth buffer
- Frustum culling
- Variable rate shading
- Mesh shading
- Deferred clustered lighting
- Sparse virtual texture
Main engine:
Demo program:
Test program:
- SuperDemo+
- SuperTerrain+
- SuperAlgorithm+
- Device
- Host
- SuperRealism+
- SuperTerrain+
- SuperAlgorithm+
- SuperTest+
- GLAD: Pre-compilation of
glad.c
for source and GL-context sharing among build targets. - SuperTerrain+: Main procedural terrain generation engine.
- SuperAlgorithm+: A library of useful algorithms for terrain generation.
- SuperAlgorithm+Host: Algorithms that are best suited for CPU execution.
- SuperAlgorithm+Device: Algorithms that can be benefited from mass parallel computing using GPU.
- SuperRealism+: A rendering engine for photorealistic rendering, with some handy GL functions and object wrappers.
- SuperAlgorithm+: A library of useful algorithms for terrain generation.
- SuperDemo+: An application which demonstrates the usage of the main engine.
- SuperTest+: Unit test program.
Option | Note | Default |
---|---|---|
STP_CUDA_RUNTIME_LIBRARY | Set the global nvcc compiler flag -cudart= to the value set |
Shared |
STP_BUILD_DEMO | Enable SuperDemo+ program build | ON |
STP_DEVELOPMENT_BUILD | Enable development mode | OFF |
STP_DEVELOPMENT_BUILD::STP_CUDA_VERBOSE_PTX | Append to the global nvcc compiler flag with --ptxas-options=-v |
ON::ON |
STP_DEVELOPMENT_BUILD::STP_BUILD_TEST | Enable SuperTest+ program build | ON::ON |
STP_DEVELOPMENT_BUILD::STP_ENABLE_WARNING | Enable all compiler warnings | ON::ON |
Note that ::
denotes a CMake dependent option. Pattern A::B default to valueA::valueB means option B is depended on option A, and B is exposed in CMake cache set to valueB by default if and only if A is set to valueA; otherwise B is hidden from the user and set to NOT valueB.
- CPU
- GPU
SuperTerrain+ is currently exclusive to Nvidia GPUs. Ray tracing is powered by Nvidia OptiX; unlike DXR or VKR, it does not require a RTX board to run, but we still recommend using such graphics card for the best performance.
Legacy | Ray Tracing |
---|---|
- OS
The project is mainly developed with Visual Studio 2019 on Windows 10, and occasionally tested on some Linux systems with GCC. The codebase does not rely on any OS-specific API or feature, it should be portable if you are using other environment. Please note that I am not a Mac user and don't personally own a Mac device, hence the project is untested on MacOS.
This is usually not a problem if your GPU meets the minimum system requirement and have a relatively recent driver installed. If you are unsure, we recommend checking with OpenGL Extensions Viewer or online extension database.
- OpenGL 4.6 core profile
- GL_ARB_bindless_texture
- GL_ARB_shading_language_include
- GL_NV_draw_texture
- GL_NV_gpu_shader5
- GL_NV_shader_buffer_load
- GL_NV_shader_buffer_store
The following extensions are not required but will be made used by the engine automatically whenever applicable.
GL_NV_mesh_shaderGL_NV_primitive_shading_rateGL_NV_representative_fragment_testGL_NV_shading_rate_image
To reduce the size of repository and keep everything clean, all external materials are not included in the commit.
To simplify the setup process for the first-time build, the following resources are managed automatically by CMake and no additional setup is required. All the rest of the aforementioned dependencies are required to be installed on your computer.
- Assets such as texture
- stb_image.h
- Generated GLAD
CMake will download the required files, from either GitHub Releases in this repository, or the respective repository of 3rd-party library, to a directory STPResourceCache
located at the root of your binary directory. The build system will not re-download them if they already exist. The build system will automatically update these files whenever a newer version is available. Otherwise, if your older version fails to compile or run, simply deleting the respective directory within STPResourceCache
can purge the cache and will force a re-download next time the program is built.
SuperTerrain+ uses CMake to build and it behaves similarly to most CMake projects. You may skip these basic instructions if you are familiar to CMake and instead focusing on setting up dependencies and CMake options.
# use shallow clone to speed up if you only wish to run the demo
# for development purposes please do a blob-less clone by replacing `--depth 1` with `--filter=blob:none`
# avoid full clone due to large assets in the commit history
git clone -b master --depth 1 https://github.com/stephen-hqxu/superterrainplus.git
cd ./superterrainplus
mkdir build
cd ./build
cmake ../
SuperTerrain+ build script automatically searches for dependencies; in case of any error, please make sure you have all third-party libraries installed on your computer. You may want configure CMakeCache.txt before moving on to the next step to build the application.
REM Windows; you can either compile via Visual Studio GUI from the generated VS solution,
REM or alternatively the command line like this
cmake --build ./ --config Release --target ALL_BUILD
Or:
# Unix
make all
Compilation of the engine may take up to 5 minutes. You may obtain the following executables:
SuperDemo+
if demo build is enabledSuperTest+
if test build is enabled
This section contains source code and libraries that are not dependencies of this project but they are where ideas and inspirations are taken from. I will try my best to give attributions and copyright notices for all publications used; in case something is missing, please open an issue.
For redistributed / adapted / derived open source projects, see 3rd-Party directory to find their licenses. For academic style BibTex references, check out the Report directory. Unless otherwise specified by licenses listed in 3rd-Party directory, all works presented in this repository are distributed under the license as stated in LICENSE file.
- Particle based hydraulic erosion
- Minecraft biome generator
- Linear time Gaussian filter by Ivan Kutskir
- Stratified sampling technique from GPU Gems 2
- Animated grassland generation
- Tree Generator by Andrew Marsh
- Normal map blending
- Simulating the Colors of the Sky from Scratchapixel
- Physically-based atmospheric scattering
- A Primer On Efficient Rendering Algorithms & Clustered Shading by Ángel Ortiz
- Forward vs Deferred vs Forward+ Rendering with DirectX 11 by Jeremiah van Oosten
- SSAO from Learn OpenGL
- HBAO and HBAO+
- PBR theory from Learn OpenGL
- Procedural water animation
Shadow
- Cascaded Shadow Mapping by Márton Árbócz from Learn OpenGL
- Cascaded Shadow Maps from Microsoft
- Variance Shadow Maps
Night rendering
HDR
- Filmic tone mapping functions by Bruno Opsenica
- HDR Theory and practice by Hajime Uchimura
- Advanced Techniques and Optimization of HDR Color Pipelines by Timothy Lottes
- Uncharted2: HDR Lighting by John Hable
- Tone mapping curve sketch
- Tone mapping rendering comparison