Friday, May 08, 2009

procedurally generated cities

Here are some instructions on how to make a procedurally generated city in povray.

1) There are mathematical functions which vary between 0 at 1 in space.   They are smooth, in that any two points close together are likely to be similar, but random, in that any two points far apart are unlikely to be similar.  Here is a black and white representation of one such "noise function".  There are millions of ways to make the noise-- you can have ones where the gradations are steeper or more jagged or more linear or whatever.

2) One can take this noise function into some 3D programs (here, povray) and view the isosurface-- where every point of dark and light responds to some degree of elevation:

3) One can even "terrace" the isosurface.  I set up a step function here were every value below a certain threshold is a constant value, whereas the surface varies proportionally to the value above that limit.

4) And then texture it to make it look like a landscape. 
I made the flat area like a sea, gave the "shorelines" a sandy texture, and put green mountains at the highest values.

5) Why not make some cities! Take the same isofunction and terrace it a bit differently:

6) Then texture it like a city, with pools, stone terraces, blue windows, and rooftop gardens. This is what I think is quite cool.
It is an interesting exercise, in that it allows one to design a living space that completely conforms to the geometry of the landscape without knowing the landscape beforehand.   Couldn't you imagine some loony millionaires or students at progressive college campus wanting to live like this?


No comments: