Terrain3
Geometry clipmap to represent procedural FBM terrain that uses analytical normals.
Install / Use
/learn @nolmoonen/Terrain3README

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
ENTERfor a demo. - Use
F1,F2,F3,F4to 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.
Related Skills
node-connect
350.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
350.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
350.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
