Procedural Modeling of Buildings
Senior Design Project for Digital Media Design — Spring 2021
Houdini, Python, Maya
Overview
In my final semester of senior year, I underwent a senior design project. Over the course of my major, Digital Media Design, I explored different concepts in the field of graphics, such as 3D modeling, viewing transformations, polygon and mesh structures, animation, procedural graphics, and more. I also experimented with different graphics related programs, such as Maya and Houdini.
For my senior design project, I decided to do an investigation into the procedural generation of buildings using various techniques.
Research
To learn more about procedural generation of buildings, I looked at SIGGRAPH papers. I read Procedural Modeling of Buildings by Muller, Wonka, et al, and Procedural Modeling of Cities by Parish and Mueller, which both outline the procedural generation of buildings.
Procedural modeling is a powerful way to generate geometry. It is time efficient, as one does not have to individually model every part of the geometry. For creating geometric structures such as buildings, one can use procedural methods such as CGA shape and modified L-Systems. However, procedural modeling is also very difficult to control, especially if it is grammar based. This is because there are a lot of attributes that can be considered in the algorithm when creating the models and they need to be fine tuned in order for the model to look properly like a building. Since procedural generation involves randomness and noise, it is easier to create organic shapes like terrain or trees from this. As a result, we need to introduce rules that we follow to create models that look man-made.
Process: Houdini
I first decided to experiment with Houdini and create a Houdini tool.
Houdini allows for the user to dynamically change parameters and see the results in front of them instantly. A big chunk of this time went towards actually learning how to make Houdini Digital Assets (HDAs) and understanding the mechanics behind node-based procedural modeling as well as VEX based manipulation of geometry. After this, I was able to produce a method to generate buildings which did not make use of shape grammars, but rather made use of the L-System procedural method. Houdini has a built-in L-System node and I used this to create the floor plan of the building. By making the rules such that the turtle can only turn at 90 degree angles, I created a floor plan that seemed “block-y” in nature, and built up from there by using solely nodes. This approach is unique from what I had originally intended to create in that it required little to no code, the only “code” appearing in the form of VEX to manipulate points or add point normals. Through using nodes and premade assets like windows and doors, I created a basic building generator in Houdini.

Figure 1: GUI of Houdini Tool
There were various parameters that one could have controlled in this tool. The number of floors in the building denoted how many floors the building would have. The building shape seed was linked to the random seed that the L-System node used; that parameter was connected to the frames in Houdini which one could scrub through to see the different types of buildings one could make by altering the L-System slightly. Shape iterations denoted how many times the L-System would iterate, so the more iterations, the bigger the building floor would be. Asset Seed referred to the seed used for the random value generator when placing down assets near the building or assets near the windows. Window frequency and Balcony frequency denoted how frequent that random windows and random balconies should be placed. There are checkboxes for roof or fence which denote whether or not we want a roof or a fence. Additionally, there is a scale slider that allows one to scale the entire asset down or up. Finally, there is a layering option which allows users to add an extra layer (extra floor) with different details depending on the custom made assets.

Figure 2: Example building from Houdini tool
My evaluation of this method is that although node-based programming is really powerful, the node-network that I created in the end was too random in some places and too uniform in other places. The image in Figure 2 can roughly be categorized as a building, but in real life looks too random to be a building in terms of floor plan and yet the facades look oddly uniform at the same time. That led me to switching gears and trying a different method to creating buildings.
Process: Python and Maya
I wanted to create actual rules where you could customize what types of buildings a user wanted to represent. As such, I decided to pursue use of the shape grammar method, a method presented in the SIGGRAPH paper Procedural Modeling of Buildings by Muller, Wonka, et al. My implementation of this algorithm was done in Python and visualized in Maya by outputting OBJ files. I started the process for this by creating a simple struct for the shape which can be seen in Figure 3.

Figure 3: Shape.py class
A shape contains basic information such as its parent, the symbol it represents, the type of geometry within the shape, position, and scale. One can also include other attributes such as rotation and more. I then created a class which parses through the shape grammar for a user-input number of iterations and ends up expanding the shape grammar. This was one of the key parts of the algorithm since it would replace non-terminal shapes with successors and build the code behind the actual building. We see this algorithm in Figure 4.

Figure 4: Shape Grammar Main Loop
The final part of this algorithm was to generate rules which would allow me to create buildings. However, before generating these rules, I finally decided to pick a theme. This is because when trying to generate rules, one needs directions and artistic vision to create a desired result. I ended up picking the theme of New York Skyscrapers because they lended themselves to having identifiable patterns which was important for shape grammar building. They also looked fairly different and interesting visually.

Figure 5: Examples of NYC buildings
Surprisingly, one of the more challenging parts of this project was to come up with individual rules for each building. This is because I had to identify a pattern that could build on itself when iterated on. For the beta version, I ended up creating the Lipstick building along with the Empire State building. I’ll briefly go through the rules for the Lipstick building.
​
Lipstick Building Grammar Rules
-
Terminal Rule: T → T
-
Rule #1) A → TBC
-
T = base
-
B = building block
-
C = roof
-
-
Rule #2) B → TBC
-
T = building block
-
B = smaller building block
-
C = roof
-
-
Rule #3) C → [ ]
-
Remove this piece of geometry
-

Figure 6: Lipstick building iterations
Here, we have shapes that iterate on themselves and replace themselves. Looking at Figure 6, the base here would be a terminal shape, but the blue cylinder block duplicates itself using rule B as it creates another version of itself as a terminal shape, a smaller version of itself, and then a roof appropriately scaled to place on top of that version of itself. We can see the roof in green as it follows rule C, which is to remove itself any time it is iterated on. This is so we do not have roofs in the middle of the geometry and so that we can appropriately scale the roof when we need to. As such, we get the final version of the renders shown in Figure 7.

Figure 7: 1, 3, and 6 iterations for Lipstick building
I will also briefly go over the rules for the Empire State Building.
Empire State Building Grammar Rules
-
Terminal Rule: T → T
-
Rule #1) D → TTTTECCC
-
T1 = base
-
T2 = baseBox1
-
T3 = leftPillar
-
T4 = rightPillar
-
E = tallBox
-
C1 = leftFinalPillar
-
C2 = rightFinalPillar
-
C3 = roof
-
-
Rule #2) E → TTTECCC
-
Similar to rule #1 but WITHOUT the base
-
-
Rule #3) C → [ ]
-
Remove this piece of geometry
-

Figure 8: Empire State building iterations
Looking at Figure 8, this one is a little more complicated in terms of scaling and placing assets, but we still have a set rule system that creates this building. If we look at our reference image, we have a base for the empire state building and a block surrounded by two pillars that are taller than it. Before we get to the roof, we have a TALL block with two pillars on the OUTSIDE of this block which are actually SHORTER than it. So the way the rules would work for this are like so: we want to keep the base and this block plus the two smaller pillars surrounding it in RED. Then, we want to make the taller block with the two pillars surrounding it and the roof on top of it. The taller block is BLUE because if we keep iterating on it, it will become one of the smaller kinds of blocks which has pillars that are taller than it rather than shorter than it. Remember that the GREEN blocks delete in the next iteration. We can see this in the next iteration as the blue block becomes the brighter red block and has two new pillars generated around it. It also generates a new TALL block with more pillars and another roof scaled appropriately. To summarize, rule D creates the basis of the Empire State building, Rule E expands the expand-able shapes within the basis of the Empire State building, and Rule C removes miscellaneous geometry that would not be terminal and should be removed between iterations. As such, we get the final version of the renders shown in Figure 9.

Figure 9: 1, 2, 3, and 4 iterations for the Empire State building
I created another type of NYC building: the Chrysler building. I will also briefly go over the rules for the Chrysler building.
Chrysler Building Grammar Rules
-
Terminal Rule: T → T
-
Rule #1) F → TGIHC
-
T = base
-
G = left box
-
I = right box
-
H = main building
-
C = roof
-
-
Rule #2) G → TG
-
Expands the left block with a smaller one on top
-
-
Rule #3) H → HC
-
Expands main building with a smaller box and roof
-
-
Rule #4) I → TI
-
Expands the right block with a smaller one on top
-
-
Rule #5) C → [ ]
-
Remove this piece of geometry
-

Figure 10: Chrysler building iterations
Looking at Figure 10, I believe that this is less complicated to understand than the Empire State building, but it actually requires more rules. We have one base which is shown in pink. Between iterations the base stays as a terminal block. We also have the left and right blocks, left shown in blue and right shown in red. For the left blocks, these are replaced with a scaled down version of the same block but shifted slightly to the RIGHT so that it aligns with this inside edge. The symmetrical operation is done with the right RED blocks. It is replaced with itself as a terminal shape and then a slightly scaled down version of itself which is translated upwards and to the LEFT so that it aligns with this inner edge. If we look at this reference model, it looks the same on the inner edge. As for the main building block and the roof, those are scaled based on the number of iterations as well the scale of the previous main building block that we are replacing. So this green building block is taller than the other block but the roof’s height is dampened by the number of iterations so it does not become an incongruously tall roof. The main reason this one has more rules than the Empire State building despite the Empire State building being more complicated is because this one is symmetrical. I couldn’t do the left and right blocks in one rule because one of them shifts to the right and the other shifts to the left to get this inner alignment, so I separated them into symmetrical rules. As such, we get the final version of the renders shown in Figure 11.

Figure 11: 1, 2, 3, 4, and 5 iterations for the Chrysler building
Process: Procedural Modeling of Cities
I’ve generated 10 custom shape grammar rules, created 3 building types, and used 6 Maya OBJs as building blocks for the resulting buildings.
Another paper by the same authors is entitled Procedural Modeling of Cities by Parish and Mueller. This paper presents methods to procedurally place buildings in a city-like fashion. Although I did not go this far with the method since I feel that this would be another project, I created some basic ways to randomly place buildings to generate “cities”. I did so with Python code. I divided the world into grid cells the size of the building base (which was 10 units in the x and 6 units in the z) and I added an offset of half a unit to create some space between the buildings. For a grid size of 8 by 8, I generate random iterations of either the Empire State building or the Chrysler building and place them at random within the grid.

Figure 12: front view of random building placement

Figure 13: bird’s eye view of random building placement
Figure 12 and Figure 13 show the frontal view and the bird’s eye view respectively of this random method of basic city generation. I also tried using city generation which would follow a grid-like structure and a pattern befitting of New York cities. I used a grid of size 8 by 8 and filled it with 2 by 2 blocks of buildings. This can be seen in Figure 14 and Figure 15 with a frontal view and bird’s eye view respectively.

Figure 14: front view of city block building placement

Figure 15: bird’s eye view of city block building placement
Conclusions and Future Work
These randomized placements of buildings were what I was able to accomplish as a result of my shape grammar method implementation.
If I were to continue this project, there are many more aspects that I could add to it to improve it. I think it would be useful if it were an actual tool. Right now I’m going directly into Python to change parameters, but if I could actually make a tool where you can change parameters and instantly see results, that would be useful for technical artists or just general people who want to use this tool. Two options for this that I can think of are integrating it into Houdini or even doing a TypeScript WebGL application like I’ve been doing in my Procedural Graphics independent study.
To expand further, I could also continue just generating rules by hand and making more types of NYC buildings. It is also possible to combine random rules across buildings to make a more organic building which is atypical of real-life inorganic buildings. Other improvements include how although I did custom make some of the assets already such as the different roofs or building bases, I could add more details like windows and doors. One other thing I was considering is related to the whole “tool” aspect of this project. If any user were to work this project as a tool they should be able to input their own assets. Right now I assume that every asset that one inputs is the size of a unit cube, so I think that I should account for size throughout the transformation process of the shapeGrammar so I can make it uniform. Also adding custom textures to the buildings could help visually.
If I were to expand upon this project even more, I would try to do procedural modeling of cities. One of the authors of the Siggraph paper that I referenced for procedurally modeling buildings also helped write a Siggraph paper for procedurally modeling cities. I read this paper towards the beginning of the semester and think it’s a great extension of modeling buildings. It’s also really interesting because it goes through how real life cities have patterns in how they look, such as New York and Paris.
Overall, I think the shape grammar method of creating buildings procedurally is a highly versatile procedure. I was able to create three different types of buildings from it and that only required ten different rules. I think that in general, there are many different ways to achieve a solution, as I first was able to create a building in Houdini and then moved on to creating it in Python and Maya via scripting, both methods to varying degrees of success.
Presentation
Here is the presentation of my final results, which contains overviews of the methods used and notes about my progress and conclusions. Here is a link to view it in Google Slides.