In the CityEngine CGA grammar rules, basic roof shapes such as flat, hip, gable, pyramid, and shed are defined. Examples of basic rules for different roof shapes are as shown in the figure below:
However, roof structures of campus buildings are complex. For more realistic and sophisticated roof types, new specific rules should be written for each complex building and this inverts the aim of procedural modeling which is facilitating the modeling process instead of hand modeling each building. Instead of writing complex rules or assigning one roof type for each building footprint, a combination of roof types is used for each building. In other words, each section of a building with a different height value has a roof type assigned to it. This has been possible by the use of LiDAR information. Each building is divided into different roof sections based on different heights and types. For instance, the following figure has a complex roof type. The middle parts are flat with various heights. The edges are shed and need a different rule to be applied.
A ‘roof type’ attribute has been created for the building footprints shapefile based on Google Earth images. To select different shapes with similar roof types in CityEngine, a simple python scripting is written. The python editor is executed inside CityEngine and is convenient for writing scripts and executing. The figure below is the window for creating a python module and the next figure shows a sample python code for selecting roof types of the same value.
The script then can be run by pressing F9 or selecting Run Script from the Python menu. Then for selected shapes, the rule parameter of roof type is modified. You can see selected shapes and roof type options in the figure below.