pboechat / ProceduralCity

Unity demo that uses a few tricks to build random nice-looking 3D cities

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Procedural City

Procedural City is a demo that uses a few tricks to build random nice-looking 3D cities.

Screenshot


Idea

First, neighborhood blocks are randomly placed in an irregular rectangle grid.

Irregular Grid

Then, building allotments are packed inside blocks using this bin packing algorithm. Bin packing uses a heuristic that tries to maximize edge contact for "bins". This leads to better fitting of allotments along block edges. Once blocks are filled, non-edge allotments are discarded.

Bin Packing

Buildings are extruded from allotments and their façades decorated by two pattern matrices. Pattern matrices are picked from one of six achitectural styles (art deco, art noveau, brownstone, chicago old school, international and modernist). One pattern matrix implements simple block extrusion/exclusion to be performed in the façade geometry. Another determines which element (e.g., window, door, column) should be appended where in the façade. Details (e.g., headers, rails, firestairs) are randomly selected according to the defined achitectural style. Finally, some common props (e.g., chimney, water tank) are scattered around the rooftops.

Building Generation

Download

Windows

About

Unity demo that uses a few tricks to build random nice-looking 3D cities


Languages

Language:ShaderLab 37.5%Language:C# 33.2%Language:JavaScript 29.1%Language:HLSL 0.2%