---
id: "procedural-city-roads"
title: "Procedural City Generation (L-system Road Networks)"
aliases: [Parish and Müller city generation, CityEngine road growth]
domain: "procgen"
stage: "procedural"
realtime: "interactive"
platforms: [cpu, houdini, blender, unity, unreal]
year_introduced: 2001
inputs: [heightfield, texture]
outputs: [graph, layout, mesh]
style: "photoreal"
dynamic: "static"
cost: "medium"
authority: "Parish & Müller, 2001"
url: "https://texelatlas.vercel.app/t/procedural-city-roads/"
sources_verified_at: "2026-11-29"
---
# Procedural City Generation (L-system Road Networks) (Parish & Müller, 2001)

> Generate a city by growing a street network with an extended L-system that responds to population-density and terrain maps, then subdividing the blocks into lots and extruding buildings.

## Reach for it when

- generate a believable street network automatically
- road layouts should follow terrain and population
- want city roads with highways and local streets
- fill a large world with plausible urban layout

## How it works

The pipeline starts from input maps (elevation, water, population density). An extended L-system grows the road network: each road segment either continues or branches, with parameters adjusted by the local maps and by local constraints such as avoiding water or slopes, and segments snap to nearby intersections to form a connected graph. Road patterns (grid, radial, organic) are set per region. The enclosed regions between roads are extracted as blocks and recursively subdivided into building lots, and buildings are generated per lot (originally with a lot-specific L-system, later with CGA-style grammars). Textured facades then dress the geometry.

## When to use it

Choose it to generate road graphs and block structure for settlements that respond to terrain and density maps. Prefer [CGA Shape Grammar (Procedural Buildings)](https://texelatlas.vercel.app/t/cga-shape-grammar.md) for the building detail pass, [Voronoi Diagrams and Lloyd Relaxation](https://texelatlas.vercel.app/t/voronoi-lloyd-relaxation.md) for organic block subdivision, [Poisson Disk Sampling (Bridson)](https://texelatlas.vercel.app/t/poisson-disk-sampling.md) for scattering trees or props in the blocks, and [BSP Dungeon Generation](https://texelatlas.vercel.app/t/bsp-dungeon-generation.md) for interior or room layouts.

## Cost

medium — Road growth and lot subdivision are fast; building mesh generation dominates for large cities.
Measured GPU Weight: 7.16× baseline (moderate) — 0.2354 ms median / 0.2419 ms p95 on Tesla T4/PCIe/SSE2 @ 1920x1080 (opengl-timer-query).
Ada L4 scaling: 5.45× baseline (light) — 0.0866 ms median (2.72× faster on L4).
Ampere A100 scaling: 4.42× baseline (light) — 0.1273 ms median (1.85× faster on A100).

## Failure modes

- Road graphs get dead ends, tiny blocks or non-planar crossings unless snapping and cleanup rules are applied
- Lots with unusual shapes cannot hold buildings and are left empty or filled with bad footprints
- Growth near water or slopes may violate constraints without careful cost functions
- Parameter interplay is non-obvious, so tuning city 'feel' is trial and error

## Dataflow

- Inputs: heightfield, texture
- Outputs: graph, layout, mesh
- Platforms: cpu, houdini, blender, unity, unreal

## Presets

### Procedural city roads — tensor-guided arterials, parcel blocks & night traffic streams (glsl-fragment; rendered 2026-11-30)

```json
{
  "P_GRID_SCALE": 5.2,
  "P_CURVATURE": 0.75,
  "P_TRAFFIC_SPEED": 1,
  "P_BLOCK_DENSITY": 0.82
}
```

```glsl
const float P_GRID_SCALE = 5.2; // P District Scale [2.5, 9.0, 0.2]
const float P_CURVATURE = 0.75; // P Tensor Warp [0.0, 1.6, 0.05]
const float P_TRAFFIC_SPEED = 1.0; // P Traffic Flow [0.0, 2.5, 0.05]
const float P_BLOCK_DENSITY = 0.82; // P Building Density [0.2, 1.0, 0.02]

float hash21(vec2 p) {
  p = fract(p * vec2(127.1, 311.7));
  p += dot(p, p + 34.5);
  return fract(p.x * p.y);
}

// Smooth urban tensor-field coordinate warp (curves streets along river & ring roads)
vec2 cityWarp(vec2 p, float curv) {
  vec2 w = vec2(
    0.26 * sin(p.y * 0.55 + 0.4) + 0.14 * cos(p.x * 0.35 - p.y * 0.45),
    0.24 * cos(p.x * 0.52 - 0.3) + 0.12 * sin(p.x * 0.42 + p.y * 0.38)
  );
  return p + w * curv;
}

vec3 aces(vec3 x) {
  x = max(x, 0.0);
  return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
  float px = 1.0 / iResolution.y;

  float scale = clamp(P_GRID_SCALE, 2.0, 10.0);
  float curv = clamp(P_CURVATURE, 0.0, 1.8);
  float spd = max(P_TRAFFIC_SPEED, 0.0);
  float bDens = clamp(P_BLOCK_DENSITY, 0.15, 1.0);

  vec2 pan = vec2(iTime * 0.12, iTime * 0.06);
  vec2 p = uv * scale + pan;

  // Winding river channel cutting across the city
  float riverCenter = 0.55 * sin(p.x * 0.48 + 0.6) - 0.25 * cos(p.x * 0.95);
  float dRiver = abs(p.y - riverCenter);
  float isWater = smoothstep(0.44, 0.36, dRiver);
  float riverBank = smoothstep(0.54, 0.42, dRiver) * (1.0 - isWater);

  // Tensor-warped street lattice
  vec2 wp = cityWarp(p, curv);

  // Level 1: Primary arterial boulevards (coarse grid)
  vec2 artCell = floor(wp * 0.5);
  vec2 artF = abs(fract(wp * 0.5 + 0.5) - 0.5);
  float dArt = min(artF.x, artF.y);
  float isArterial = smoothstep(0.055, 0.032, dArt);
  float artCenter = smoothstep(0.012, 0.003, dArt);

  // Level 2: Secondary avenues (subdivision per district)
  vec2 secF = abs(fract(wp * 1.5 + 0.5) - 0.5);
  float dSec = min(secF.x, secF.y);
  float isSecondary = smoothstep(0.068, 0.038, dSec) * (1.0 - isWater);

  // Level 3: Local residential streets & building parcels
  vec2 blkId = floor(wp * 1.5);
  float blkRand = hash21(blkId);
  float subDiv = mix(3.0, 4.5, step(0.45, blkRand));
  vec2 locF = abs(fract(wp * subDiv) - 0.5);
  vec2 parcelId = floor(wp * subDiv);
  float pRand = hash21(parcelId + blkId * 17.0);
  float dLoc = min(locF.x, locF.y);
  float isLocal = smoothstep(0.085, 0.045, dLoc) * (1.0 - isWater);

  // Base urban night map: dark slate blocks + landscaped parks
  float isPark = step(bDens, blkRand) * (1.0 - isWater);
  vec3 blockCol = mix(vec3(0.045, 0.055, 0.075), vec3(0.055, 0.12, 0.085), isPark);

  // Illuminated architectural building footprints inside non-park parcels
  float pad = 0.14 + 0.10 * pRand;
  float bldg = smoothstep(0.5 - pad + 0.03, 0.5 - pad - 0.02, max(locF.x, locF.y));
  bldg *= (1.0 - isPark) * (1.0 - isWater) * step(0.18, pRand);
  float height = 0.35 + 0.65 * hash21(parcelId * 3.1 + 7.2);
  vec3 bldgCol = mix(vec3(0.09, 0.12, 0.18), vec3(0.22, 0.28, 0.38), height);
  // Warm window perimeter glow
  float winEdge = smoothstep(0.5 - pad - 0.08, 0.5 - pad - 0.02, max(locF.x, locF.y)) * bldg;
  bldgCol += vec3(0.95, 0.68, 0.28) * winEdge * (0.35 + 0.65 * step(0.52, pRand));

  vec3 col = mix(blockCol, bldgCol, bldg);

  // River water with subtle moonlight shimmer
  vec3 waterCol = vec3(0.025, 0.065, 0.12) + vec3(0.04, 0.11, 0.18) * (0.5 + 0.5 * sin(p.x * 6.0 + p.y * 8.0 - iTime * 1.4));
  col = mix(col, vec3(0.08, 0.15, 0.12), riverBank * 0.7);
  col = mix(col, waterCol, isWater);

  // Composite road hierarchy (arterials bridge cleanly over the river!)
  vec3 locRoad = vec3(0.13, 0.16, 0.22);
  vec3 secRoad = vec3(0.24, 0.29, 0.38);
  vec3 artRoad = vec3(0.32, 0.36, 0.44);

  col = mix(col, locRoad, isLocal * 0.85);
  col = mix(col, secRoad, isSecondary * 0.92);
  col = mix(col, artRoad, isArterial);

  // Glowing golden arterial centerlines & moving traffic light pulses
  float laneX = smoothstep(0.032, 0.008, artF.y);
  float laneY = smoothstep(0.032, 0.008, artF.x);
  float carsX = pow(0.5 + 0.5 * sin(wp.x * 11.0 - iTime * 3.4 * spd + artCell.y * 4.0), 10.0) * laneX;
  float carsY = pow(0.5 + 0.5 * sin(wp.y * 11.0 + iTime * 2.9 * spd + artCell.x * 5.0), 10.0) * laneY;
  float secCars = pow(0.5 + 0.5 * sin((wp.x + wp.y) * 18.0 - iTime * 2.4 * spd), 12.0) * isSecondary;

  col += vec3(1.0, 0.74, 0.26) * artCenter * 0.55;
  col += vec3(1.4, 0.92, 0.42) * carsX * 1.15;
  col += vec3(0.35, 0.88, 1.25) * carsY * 1.05;
  col += vec3(1.0, 0.45, 0.35) * secCars * 0.55;

  // Intersection nodes glow warmly
  float inter = smoothstep(0.075, 0.015, length(artF));
  col += vec3(1.15, 0.82, 0.38) * inter * 0.65;

  // Blueprint framing vignette
  col *= 1.0 - 0.22 * dot(uv, uv) + 0.0 * px;
  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}
```

Attribution: Original interactive WebGL2 fragment shader written for Texel Atlas (MIT).

## Lineage

- extends [L-Systems](https://texelatlas.vercel.app/t/l-systems.md)

## Combination ideas

- [Cities wired by slime mould](https://texelatlas.vercel.app/ideas/slime-mould-road-networks/)

## Sources

1. [primary] Yoav I. H. Parish, Pascal Müller (2001) Procedural modeling of cities. Proceedings of the 28th annual conference on Computer graphics and interactive techniques. https://doi.org/10.1145/383259.383292 (verified via crossref on 2026-11-29)
2. [implementation] ProbableTrain (2020) ProbableTrain/MapGenerator. https://github.com/ProbableTrain/MapGenerator License: LGPL-3.0. (verified via github on 2026-11-29)

## Cite this entry

Texel. "Procedural City Generation (L-system Road Networks)." https://texelatlas.vercel.app/t/procedural-city-roads/ (accessed 2026-12-01).
