Skip to content
← SelectLAB·06PT
LAB · 06 / 09

One-seed city

Type a number and the city rises. Same seed, same city. procedural generation · instancing · WASD

How it works

Visual mode: HDRI lighting, ambient occlusion, bloom, depth of field and quality that adapts to your device. Light mode: no post-processing, for phones, weak laptops and for studying the technique.

  1. 01

    Seed

    Each block gets a number derived from the seed and its position (a hash). That number feeds a pseudo-random generator, so the same seed always builds the same city.

    r = mulberry32(hash(semente, x, z))
  2. 02

    Districts

    Low-frequency noise plus the distance to the center decides whether a block is downtown (towers), residential, industrial or a park.

  3. 03

    Infinite

    The city is split into 288 m chunks. Only the 7 × 7 around the camera exist; as you fly, the ones behind disappear and new ones are born ahead.

  4. 04

    Performance

    All buildings in a chunk are one instanced mesh; windows are drawn in the shader, with no texture, and edges smoothed with screen-space derivatives.

  5. 05

    Golden hour and fog

    In late afternoon the sun drops near the horizon: the face toward it warms up, the opposite one cools down, glass mirrors the orange sky. A low fog layer thickens with distance, and water tanks, antennas and signs come from each building’s hash. At night, cars leave light trails proportional to their speed.

    névoa = max(dist, e^(−y/22) · dist)