Tag Archives: Procedural

Building a procedural city generator in Unity with SNAPS

September 13, 2019

Took a break from this project between September 2018 and July 2019; had switched jobs and had to spend time adapting to being a Producer again. However, in mid-August of 2019, Unity released a set of prototyping assets called SNAPS. Was surprised to discover that the height measurement for SNAPS was precisely the one I used, which implied adapting the SNAPS prototyping assets for use in my Procedural City Generator would be doable.

Building a procedural city generator in Unity – AR version!

Hilmyworks' Procedural City Generation on August 28th 2018
August 28th 2018

So far, the buildings generated were accurately scaled. On August 2018 I started experimenting with AR, which I discovered that a real-size skyscraper in AR isn’t that easy to view on a phone! So I added a Minimize mode, where the buildings could be scaled down to be viewable on an AR-detected floor.

The implementation is admittedly a hack, and since some parts of the code couldn’t figure out what to do with the new scale, issues with z-fighting and object placement appeared. But on the whole, it’s a version I can show to people on my phone, so I just need to clean up my code.

Building a procedural city generator in Unity

Hilmyworks' Procedural City Generation on June 27th, 2018
June 27th, 2018

Since I was able to generate a building on any physics-enhanced surface in Unity, I can add the code into any scene, click-and-drag on a physics enabled surface and generate a building on it. Thus, when I got Gaia around the end of June, I was able to generate procedural buildings within a generated landscape scene.

Added a Post-Processing Stack effect for fun.

Building a procedural city generator in Unity

Hilmyworks' Procedural City Generation on January 12th 2018
January 12th 2018

On January 12th, 2018 I added the ability to generate finer detail on the rooftop and grid-like facades on the building walls. The added edges on top of the building created a more believable look, and I was able to adapt the code to create randomized grid patterns on the walls.

The code still isn’t perfect; top building on the left has a definite overhang. Part of the work was figuring out where the rules failed in generating believable content and correcting as I go along.

Building a procedural city generator in Unity

Hilmyworks' Procedural City Generation on January 8th, 2018
January 8th, 2018

The next version on January 8th 2018 refined the arrangement of blocks to make the layout more realistic (e.g. adding believable corners so that the windows seem feasible), and added a ground section to the buildings. The ground section allowed me to define the area the building would occupy, and randomize the scale of the upper section of the buildings. The windows are now thin slices instead of blocks, thus they can be arranged within a defined wall region.

Building a procedural city generator in Unity

Hilmyworks' Procedural City Generation on December 4th, 2017
December 4th, 2017

Was trying various projects with Unity to understand the engine back in 2016, so the procedural generation project was put on hold until late 2017. The version on December 4th, 2017 shown below was composed of stacked generated cubes of various materials, with a random placed object from a set of Gameobjects placed on top.

This was obviously non-performant, but my goal back then was to identify the rules I needed to establish to make a generated city believable. This version was to test if I could generate various window patterns on the wall surfaces and have the code randomly place objects as needed. There were observable issues – e.g. middle bottom building has windows that occur in one corner and not the other – but seeing issues like that meant I can figure out new rules to fix them.