The script is now released here.
The city is built based on a population map, which is a texture representing how populated (or rich) each area of the city is. On white pixels will stand higher buildings, and on black pixels, lower buildings. Below a gray level of 30%, no buildings will be created.
You can use any picture you like for the population map:
- draw it yourself: you can control where high buildings will be
- or use a procedural one: random placement of high and short buildings
Therefore you can greatly change the aspect of a city by modifying the parameters of the script, and also by changing the texture used for the population map.
The algorithm is simple: it iterates over the population map. For each pixel, it decides how many buildings are to be built for that pixel, their size and height, and their position. L-Systems are not used.
I designed the cities and buildings simply by observing pictures of real cities and buildings, and also by observing the results of another city engine by Mueller which I admire.
For now, buildings are simple cubes. Having detailed buildings such as those in the screenshot is possible, but not through the GUI yet. I am working on it for version 0.3.
The parameters are the following, from the bottom:
Pop map size
This is the size of the population map, and it directly affects the area covered by the city. It is the main way to increase visual complexity: simply generate a larger city.
Randomize pop map
Disable it if you use a custom population map.
If you are using a procedural texture, such as âstucciâ, you may want to keep the same type (eg stucci VS clouds) but change the layout. This is what this button is doing, by randomizing the texture offset.
Building height
If you want higher buildings, this is where you set it
Height difference
With this parameter, you can set whether short and tall buildings will have a great difference in height or not. This parameter may not always produce what you expect because it makes short buildings very short, and tall buildings very tall. So it may shorten most or all buildings to the minimum size if they do not reach a certain height before this parameter is applied.
You can increase the value of the âbuilding heightâ parameter (above) to reduce this negative effect.
Buildings per pixel
For each pixel of the population map, there may be more than one single building. The shorter a building, the more subdivisions. Here you control the probability of a building to be subdivided into many smaller ones.
Building loc variation
When a building is positioned, its horizontal locationn is varied randomly inside the area of its respective population map pixel, to make the city look less âgrid-likeâ. However, if you want the buildings to be more aligned, then decrease the value of this parameter. 0 means all buildings are aligned exactly on the population map.
Min/max hori size factor
You can control how thick or thin buildings are with this parameter. The minimum horizontal size factor is in Blender units. The maximum horizontal size factor is how many times a building can be larger than the minimum size.
Concerning all your comments
- I plan to have non-square buildings
- I plan to have networks of streets
- I plan to separate buildings faces into different materials (wall, roof)
- I plan to include illuminations for night scenes
But these are only ideas. They may or may not be implemented in the future.
May you encounter any bug, please report them on this thread. Version 0.3 with more parameters and complete buildings should come soon. And most importantly, thank you all for your encouragements!
A demo video here