mathieu.dev
All projects
Flythrough footage coming soon
Featured Project — Procedural Generation

Procedural Terrain

An infinite, multithreaded voxel world shaped entirely by layered noise — built solo in Unity during high school.

Scroll to explore
Overview

A world with no edges.

Procedural Terrain is a Unity/C# project that generates an unbounded, Minecraft-style voxel world around the player in real time. There's no fixed map: every chunk is carved out of noise the moment the player gets close, and forgotten the moment they leave.

The goal wasn't just "terrain that looks nice" — it was building the whole pipeline myself: the noise stack that decides where mountains, oceans and beaches go, the multithreaded generation that keeps the game running smoothly while the world streams in, and the Shader Graph materials that turn raw voxel data into something that actually looks like grass, stone and water.

5
independent noise layers
75%
of CPU cores used for generation
world size, streamed per chunk
1
background thread per chunk
01 — World Streaming

Chunks, threads, and a pool of GameObjects

The world is split into fixed-size chunks streamed in and out around the player based on render distance. Each chunk generates its blocks, its mesh, and a separate water mesh on its own background thread, so the main thread never stalls waiting for terrain to be carved. A small scheduler caps how many threads run at once — 75% of the machine's logical cores — and chunk GameObjects are recycled through an object pool instead of being constantly instantiated and destroyed.

02 — Shaping the Land

Five noise layers, one landscape

Height isn't driven by a single noise pass. It comes from combining several independent fractal noise layers — continentalness, erosion, a land/ocean mask, ocean depth, and a stone mask — each with its own octaves, frequency, lacunarity and persistence, loosely following the same "terrain from noise" approach used in Minecraft's modern world generation. Continentalness is additionally run through domain warping, distorting the sampling coordinates with a second noise field so coastlines and mountain ranges don't look like they were stamped out of a perfect grid.

The curve mapping continentalness to actual terrain height was first prototyped in a small Python + matplotlib script before being ported into a Unity AnimationCurve.

03 — Blocks & Trees

From noise to blocks

Once a height is decided, each column is filled in with typed blocks — grass, dirt, stone, sand — culled face by face so only visible surfaces become geometry. Trees are scattered per chunk with randomized trunk height and canopy size, rejected and retried if they'd overlap a neighbor.

04 — Shading

Shader Graph does the rest

Coloring happens entirely on the GPU through Unity's Shader Graph. The terrain material samples a texture atlas per block face and fades out near the render-distance edge instead of popping. Water gets its own graph: two layered wave-normal maps, each with independent scale and speed, are blended to fake motion on a completely flat mesh — no vertex animation required.

Try it yourself

Layered noise, in your browser

This is a small, from-scratch Perlin noise implementation running client-side in JavaScript — not the actual C# generator, which can't run in a browser. It mirrors the same idea though: octaves of noise stacked on top of each other, each one quieter and finer than the last.

Built with
  • C#
  • Unity
  • URP
  • Shader Graph
  • Multithreading
  • Simplex Noise
Source code