Procedural Cities, Procedural Roads, and L-Systems


here is a well-documented procedurally generated city by shamus young - using no art/model assets and completely built from scratch.

he writes:
"In a section of the Left 4 Dead commentary (near the very end of the initial No Mercy level) one of the developers draws attention to an apartment building in the distance. He explains that it’s a very simple building with little detail, but because it’s mostly a silhouette against a detailed sky, the eye accepts it and your mind fills in details that aren’t really there."

i agree with that - i think my goal in making a procedural river map would also be to determine which are the most easy "visual suggestions" to add to give it the general impression of being a full and detailed map... i'm not a mathematician so i don't quite know either. would a Vonoroi Diagram suffice to give the visual cues of it being a city? what is it that makes certain sketches look instinctively like maps?

lindermayer systems

another brilliant link i found was about generating procedural roads systems with L-systems by lintfordpickle who appears to be building a giant procedural world called Britonia. he makes reference to a siggraph paper which suggests the solution is in L-systems - Procedural Modeling of Cities (by Yoav Parish and Pascal Mueller).

from my sketch blog:
"L-systems or “Lindenmayer systems” are used to model the growth processes of plant development. The recursive nature of the L-system rules leads to self-similarity and so it resembles the growth of plants which grow while becoming more and more complex."

my first introduction to playing with "grammars" was with ContextFree, which is basically a simple program which will generate images from whatever grammar you provide it -- so it could be used to generate L-systems, which are just a specific sort of grammar which looks natural yet complex. so now, how will i do this... in Processing? oh good gods what am i doing let's try not to panic.



like lintfordpickle's procedural road generation, in order to make my procedural river map, i would need to figure out how to use my other "environment" inputs to direct the growth of the L-system patterns...

processing: very simple edge detection


LEFT: original PNG map of Geylang which i drew in illustrator.
RIGHT: the same image with simple edge detection in Processing.


in Processing its possible to examine an image and determine the brightness of a pixel or the pixels around it. above is a slightly modified sketch adapted from an example in Kostas Terzidis' Algorithms for Visual Design.

each pixel has a counter saying how many pixels around it are dark, and another counter inside checking to see how many consecutive pixels around it are dark. (the rule used above is that if a pixel has 2-6 dark pixels around it and more than 2 consecutive dark pixels, then its probably a border!).

i imagine that this means that, theorectically, if i fed in a seperate "topo" image (with topography features marked out in black) or if i had the river on a seperate layer, i could potentially have it detected in advance and then tell the program to avoid those "elevated" or "wet/water" areas?



See Also:
An Introduction to Lindenmayer Systems
Fractal Patterns, L-Systems and Semantics
Procedural City Generation
Procedural Modeling of Urban Environments

Voronoi Diagrams by the River

So I want to make a speculative drawing of the river. But how do we go about creating a grammar for procedurally generating city maps? Looking at how generic city maps are drawn, I was thinking that one way I might approach the drawing is to come up with a Voronoi Diagram with additional internal subdivisions.

A Voronoi Diagram is a kind of decomposition of a metric space in which there is a set of specified points in the plane (Voronoi sites), and the walls of the segments of each Voronoi site are equidistant to the nearest other site.

I downloaded Marius Watz's demo of Lee Byron's Mesh Library for Processing:



Voronoi Diagram: displays the regions of space belonging to each randomly generated point.





Delaunay Diagram: displays the optimal triangulation of these points (forming a mesh)





Convex Hull: displays the perimeter line of the most extreme points


The shapes formed are sometimes called Thiessen polygons; there are very many names for this useful concept because they were discovered independently across different disciplines, and have been used in geography, geophysics, and meteorology to estimate the influence of catchment areas or watersheds.

In 1854, the physician John Snow used a Voronoi diagram to illustrate how most of the people who died in the Soho Cholera outbreak lived closer to the Broad Street pump than any other water pump and used this to persuade authorities to remove the handle of the pump to prevent more infections.



Basically, Voronoi Diagrams/Thiessen Polygons can be used to describe the influence of a point. For example, with a Voronoi diagram, one could determine the point at which it would be most ideal to build a 7-11 that would be as far as possible from all other existing convienience stores in the city. Autonomous mobile robot also use Voronoi diagrams to calculate routes which are theorectically furthest from any collisions.

I found an interesting article entitled Dynamic Segmentation and Thiessen Polygons: A Solution to the River Mile Problem which suggests that it may be more accurate to use Voronoi Diagrams/Thiessen Polygons to subdivide a river into seperate regions of influence. River Miles/Kilometres are analogous to the highway road distance markers. However, due to the meandering nature of rivers, the River Mile may not be accurate as a measure for dividing the river into regions of influence, so Thiessen Polygons make more sense because it uses spatial distribution rather than linear division.



also check out this "Voronoi City" by Santiago Ortiz built in flash based on a voronoi algorithm (found via serial consign). i like how he states that "the aim was to construct a city using the minimum information as possible"; because when we draw our own personal maps of places, we often start with very little information and mostly just vague approximations...



See Also:
Wikipedia: Voronoi Diagram
BBC h2g2: Thiessen Polygons
Geometry in Action: Voronoi Diagrams
Wolfram: Voronoi Diagram

Colour Palette of the Singapore River

last month, i went to take colour samples of the river, and on the bus ride there, i met a cycling geographer, who also pointed out to me that the colour of the river depended on the time of the day. which was very true. the sun started off bright and blazing hot, which made for unusually bright and vibrant colours. however thanks to our erratic tropical weather, by the time i'd walked from the marina bay to boat quay, it suddenly began raining, so i also got the darker, duller grey shades of overcast days - which was particularly apparent at the shallows near the steps, where we also discovered little fish doing peculiar little horizontal swims across flat steps (to eat stair algae?), and nervous kingfishers pacing along the stone path (to eat stair fish?).

its difficult to say what colour river water really ought to be. i've been told the singapore river used to be the colour of Coca Cola, before the cleanup of the 1980s. right now, it seems as if the Singapore River is usually in camouflage army green colours, with mottled brown, grey, and white spots, to blend in with the skyscrapers and ornamental riverside foliage. the sneaksy thing, trying to slip right past us without us noticing...

From the source itself...

Welcome to a blog about "The Singapore River as a Psychogeographical Faultline".

I intend to build a speculative and generative map of the Singapore River. I chose the Singapore River because of its personal and historical significance, and I describe it as a "Psychogeographical Faultline" because the Singapore River is a site at which memories of spaces, fictional (imagined) spaces, and dream spaces interact, merge, or drift apart - like a series of tectonic plates...

This blog serves as my own record of the process of developing this work, which is being produced for The Substation Open Call 2010.

Followers