This is an experiment in drawing a simple procedural city.
The basis of the city was initially a Rhombille tiling (2D). By drawing randomly placed doors and windows on each hexagon, the illusion of a 3D city is created.
To add more detail, the roof type (flat or pitched), extra floors, and the orientation of each house are chosen randomly. I am amazed at how these minimal graphic ingredients convey such a sense of complexity, order, and space.
The city will look different at every compile and run. Press the ↻-button to run the turtle again.
In the end, I assigned a z-coordinate to all vertices. This makes it possible to change the camera orientation or to render the city in perspective view.
At the start of each run, some global visualization options are set:
- Orthographic or perspective view.
- Optional hatching to add lighting.
- Top-down or bottom-up camera position.
You can find the full source of the turtle and an SVG export here: https://turtletoy.net/turtle/789cce3829.
If you like this post, you may also like one of my other posts:
- 3D Line Art Engine (port)
- Old watch: a WebGL path tracer
- Escher and the Droste effect
- Augmented Reality and Shadertoy