Gravel

Graphics · Vulkan · 2026

Gravel

Real-Time Procedural Resurfacing Using GPU Mesh Shaders

Overview

Gravel is a from-scratch implementation of a GPU mesh shader-based procedural resurfacing framework. It takes a base mesh and procedurally generates new geometric surfaces on-the-fly at each face using the Vulkan mesh shader pipeline — task shader → mesh shader → fragment shader.

No traditional vertex input assembly is used. All geometry is read from storage buffers and generated entirely on-chip, enabling complex surface types — parametric patches, B-splines, procedural pebbles — at real-time frame rates with hardware-accelerated culling and LOD.

Features

Analytical Parametric Surfaces

Torus, sphere, cone, cylinder, Möbius strip, Klein bottle, hyperbolic paraboloid, helicoid, and egg — all generated on-chip.

B-Spline Control Cages

Bicubic B-spline and Bézier surfaces with configurable degrees, streamed directly from storage buffers.

Procedural Pebbles

On-the-fly control cage construction with noise perturbation for realistic pebble-like geometry.

Screen-Space LOD

Hardware-aware mesh amplification with adaptive level-of-detail based on screen coverage.

Frustum & Back-Face Culling

GPU-side culling in the task shader stage to eliminate off-screen and back-facing geometry before amplification.

Control Maps

Per-face element type selection via texture maps, enabling mixed surface types across a single base mesh.

Pipeline

STAGE 1

Task Shader

Performs frustum and back-face culling. Determines amplification factor per input primitive and emits mesh shader workgroups.

STAGE 2

Mesh Shader

Reads base mesh data from storage buffers. Generates the resurfaced geometry on-chip — vertices, normals, UVs — without vertex input assembly.

STAGE 3

Fragment Shader

Shades the generated geometry with per-surface material properties, supporting both flat and smooth shading modes.

Technology Stack

LanguageC++17 (host) · GLSL with GL_EXT_mesh_shader
Graphics APIVulkan 1.3 with VK_EXT_mesh_shader
ShadersglslangValidator → SPIR-V
WindowingGLFW
MathGLM
UIImGui (Vulkan backend)
Mesh LoadingOBJ loader (n-gon support)
BuildCMake 3.20+

Requirements

HARDWARE

  • NVIDIA GPU with mesh shader support
  • Tested on RTX 3080 / Ampere+
  • Driver version 535+

SOFTWARE

  • Vulkan SDK 1.3+
  • CMake 3.20+
  • C++17 compiler (GCC 9+, Clang 10+, MSVC 2019+)
  • glslangValidator (included with Vulkan SDK)