CodeRigor

COURSE / REAL PRACTICE

Procedural worlds

Generate worlds from code in NumPy: gradient noise, terrain meshes, hydraulic erosion, even object placement, isosurfaces, planets and a ray-marched scene. Lessons pair with public videos by Sebastian Lague and Acerola. Unofficial practice material, not affiliated with the videos’ authors.

Free to useLessons & exercises7 authored lessons3 units
Start with the first lesson.

Read the explanation and diagrams, then work through the practice. Your browser profile supplies your saved progress.

What you’ll work toward

Generate repeatable terrain, meshes and planets from a seed, check them with exact geometric tests, and render a distance-field scene without a graphics API.

Read an explanation, inspect the diagrams and work through the available checks, debugging exercises and builds. Feedback and prerequisite links guide the next step.

Before you start

This course builds on these skills:

Individual lessons can add prerequisites. Your lesson progress shows your actual readiness.

A look inside the first lesson

Gradient noise and octaves

Python
def fade(t):
    return t * t * t * (t * (t * 6 - 15) + 10)


print([round(fade(t), 6) for t in (0.0, 0.25, 0.5, 0.75, 1.0)])
h = 1e-6
print(abs(round((fade(h) - fade(0)) / h, 4)), abs(round((fade(1) - fade(1 - h)) / h, 4)))

Your lesson sequence

Follow the same units and lessons in either view. Prerequisite links and your practice progress stay with each lesson.

UNIT 013 lessons Noise and terrain
  1. LESSON 01.01

    Gradient noise and octaves

    Hash a lattice into gradients, blend them with the quintic fade so the surface stays smooth, then stack octaves into fractal terrain noise.

    Open lesson
  2. LESSON 01.02

    From heightmap to mesh

    Turn a grid of heights into vertices, consistently wound triangles, area-weighted normals and a lower-detail index list, then read the ground height back off the triangles.

    Open lesson
  3. LESSON 01.03

    Hydraulic erosion

    Roll droplets over a height map: sample it bilinearly, spread erosion with a brush, carry and deposit sediment, and prove the total height is conserved.

    Open lesson
UNIT 022 lessons Placement and surfaces
  1. LESSON 02.01

    Even placement with Poisson discs

    Scatter points that are never closer than a radius yet leave no big gaps: a background grid, annulus candidates, and a 5 by 5 neighbour check, tested by brute force.

    Open lesson
  2. LESSON 02.02

    Surfaces from a scalar field

    Turn a grid of field values into a watertight triangle mesh with marching tetrahedra, then check it by edge counts, Euler characteristic and enclosed volume.

    Open lesson
UNIT 032 lessons Planets and rays
  1. LESSON 03.01

    Planets from a cube

    Build a closed planet mesh from six cube faces: merge seam vertices, keep the winding outward, even out cell sizes and carve a crater.

    Open lesson
  2. LESSON 03.02

    Capstone: ray march a world

    Build distance functions, sphere tracing, normals, soft shadows and a camera, then render a small signed-distance world and check it against analytic hits.

    Open lesson

WATCH ALONG

Videos for these lessons

One hand-picked talk, lecture or tutorial per lesson, in course order. They play here when you press play; nothing loads from the video provider before that.

6 videos· 1 h 8 min

  1. 01Gradient noise and octaves

  2. 02From heightmap to mesh

    Covers building a mesh from a vertex list and triangle indices, one face of a surface at a time. The shape is a sphere, not a heightmap, but the vertices, the triangle order and the mesh bookkeeping carry over to this lesson.

  3. 03Hydraulic erosion

  4. 04Even placement with Poisson discs

  5. 05Surfaces from a scalar field

    A short video on marching cubes: how a grid of density values becomes a mesh, then editable and procedural terrain and an underwater scene. Watch it for the picture; here you build the tetrahedron variant of the same idea.

  6. 06Capstone: ray march a world

    A short tour of signed distances, ray marching, combining shapes and lighting effects. Watch it before you build: it covers the same topics as this lesson's distance functions, march loop and unions.