Terrain Engine Introduction

Sunday - 21.08.2016 - Thomas Deliot


Introduction For almost two years now we've been working on a terrain engine project on which we've spent most of our free time.
This project aims to create a real-time terrain engine capable of generating realistically scaled and detailed terrains on the fly, mimicking real-life sceneries, for interactive uses like simulators and video games. It started as a subject we suggested to a teacher for a six-months school project we had to do, then kept on going as a game project, with the three of us splitting the workload between this and gameplay programming.

The project has been built using Unity so far, and it is for now intended to be used with Unity for our future projects. But over the two years of development its core has progressively moved further away from Unity itself into a DLL plugin, and is now being used as a generator feeding Unity meshes and shaders with the terrain data. In the future, it could become a completely separate API that can be implemented in other engines like Unreal Engine, or other custom 3D engines.

Feature summary - 1:1 scale terrains using heightmaps of Earth areas and procedural terrain detailing.
- Fast terrain generation running on the GPU.
- Terrain resolution down to centimeter-level, capable of pixel-wide details in the distant terrain.
- Procedural material and vegetation placement mimicking natural processes.
- View/Draw distance limited by realistic atmosphere simulation only.
- Physics support.
- (In development) Realistically scaled volumetric cloud coverage and weather system.
- (In development) Terrain editing, roads, dirt paths, river bed and lake placement.

​Detailed features - Progressive level of detail system using quad-trees and 2D grids of vertices.
- Sky simulation and atmospheric scattering as a post-effect, implemented from Scrawk’s work featured on his blog (now deleted).
- Usage of 16-bits grayscale height maps to define the terrain shape down to a user-defined precision, with procedural algorithms refining the terrain down to centimeter resolution.
- Procedural refinement of the terrain simulating natural shapes and erosion, with 3D displacement of the vertices allowing for vertical cliffs and overhangs without being a voxel-based engine.
- Generation of terrain tiles (vertices, normals and additional informations) executed asynchronously by the GPU, using a native DLL plugin dispatching DirectCompute shaders from a separate worker thread.
- Performance friendly detail boosting, refining each tile’s normals and material placement maps more than its vertices, allowing for pixel-perfect detail without rendering millions of triangles.
- Volumetric clouds as a ray-marching post-effect, using temporal reprojection to reduce the rendering load by updating one out of four screen pixels each frame (inspired by Andrew Schneider's presentation on volumetric clouds in Horizon: Zero Dawn).
- Unified material and vegetation placement system using weighted probabilities in a hierarchical “biome-defining tree”, placing dirt, snow, rocks, trees, bushes and grass on the terrain using parameters depending on the slope/altitude, and a conglomeration parameter. These hierarchical weighted probabilities combined with random numbers allow for more natural looking placements of materials and vegetation without the drawbacks of using gradient noises (complexity and repetitive patterns).
- rendering realistically dense forests, bushes and grass covers with ability to use SpeedTree's billboard atlases.
- Integration of asphalt/dirt roads, river beds, fields, etc. directly into the terrain itself and manual biome/vegetation objects placement, with a terrain editing system using geometric overlays (shapes and splines) to modify the geometry and material/vegetation placement of the terrain at specific places.
- Physics support with mesh colliders.

The featured screenshots show the terrain engine working on a 155 by 155km area of the Alps around the Mt Blanc, using a one arc-second DEM heightmap (30m precision), running on mid-range hardware (dual-core 3GHz CPU/GTX 850m laptop).

Picture 1 Picture 2 Picture 3 Picture 4 Picture 5 Picture 6 Picture 7 Picture 8 Picture 9 Picture 10 Picture 11 Picture 12 Picture 13 Picture 14

Last Articles

Rendering dense and distant forests with ray-casting

Sunday - 06.11.2016

Rendering dense and distant forests with ray-casting

Equilibrium released!

Thursday - 13.05.2015

Equilibrium released!