Skip to content

Geometry clipmap to represent procedural FBM terrain that uses analytical normals.

Notifications You must be signed in to change notification settings

nolmoonen/terrain3

Repository files navigation

terrain3 procedurally generates terrain and represents it with varying levels of detail using a geometry clipmap. The terrain itself is created using fractional Brownian motion where the accumulated derivative of the noise values is used to scale the accumulated values. The analytical derivative of the terrain is found, using which the normal of the terrrain is calculated with little to no additional overhead. The terrain height and gradient values are calculated using an OpenGL compute shader.

Controls

  • Hit ENTER for a demo.
  • Use F1, F2, F3, F4 to toggle wireframe, debug drawing, terrain normals, and debug information.
  • Use the middle mouse button to rotate, use shift and the middle mouse button to pan, and use the scroll wheel to zoom.

Performance

At its most detailed level, the terrain is represented with a resolution of ten centimeters. The above image displays movement at about 200 meters per second, which a system with a Ryzen 5 2600 and an RTX 2070 takes roughly 0.013-0.017 ms to update the terrain and 0.14-0.18 ms to render it at 1080p.

System requirements and dependencies

Windows 10 and C++17. Building is tested with MSVC, but other compilers should work as well. The following third-party dependencies are included:

  • glad2 for loading OpenGL and WGL.
  • imgui for rendering text.
  • stb for reading and writing PNG files.
  • Poly Haven for grass and cliff textures.

Resources

  • Terrain Rendering Using GPU-Based Geometry Clipmaps
    Asirvatham, A. and Hoppe, H. [link]
    The technique presented in this paper is used to represent the terrain at multiple resolutions.
  • Geometry Clipmaps: Simple Terrain Rendering with Level of Detail
    Savage, M. [link]
    Article on the above paper with helpful practical information.
  • OpenGL ES SDK for Android Tutorial
    Arm Software [link]
    The code of this repository forms the base of this project.
  • Value Noise Derivatives
    Quillez, I. [link]
    This article explains how derivatives can be extracted from value noise and how these derivatives can be used to make interesting terrain.

About

Geometry clipmap to represent procedural FBM terrain that uses analytical normals.

Topics

Resources

Stars

Watchers

Forks