Buildings to CityEngine

03-31-2016 02:29 PM
MVP Regular Contributor

I am trying to bring my cities buildings into cityengine and apply 2 simple rules.

rule 1: building height

rule 2: roof type

I then want to edit the buildings to change the appearance to be that like the actual building.

Kind of like what was demoed here: CityEngine Feature: Facade Texturing - YouTube  time 0:30 to  0:42

I think what I am looking for is to create the most realistic model then from there edit each feature. I do not want the feature to change after I edit it. Would what I am looking for be an object?

Are there any good tutorials on how to do this? I cannot find anything that is very helpful.

0 Kudos
1 Reply
Esri Regular Contributor

First, you'll need to import your shapes into CityEngine.  Check out this tutorial on importing shapes from different sources:

Tutorial 5: Import initial shapes—CityEngine Tutorials | ArcGIS for Desktop

Then, to apply rules to the shapes, you'll have to create a cga file with the rules and assign it to the shapes.  Using extrude() you can create your building according to the specified height.  Then, there are four different roof types you could make: gable, hip, pyramid, or shed.  Here is a simple rule:

attr height = 20

attr facade_tex = "myFacadeTexture.png"

Lot -->



Building -->

     comp(f) { side : Facade | top : Roof }

Facade -->

     setupProjection(0, scope.xy, '1, '1)



Roof -->


Here is a tutorial on CGA (check out the sections "Lot rule", "Building rule", and "Texture the simple building"):

Tutorial 6: Basic shape grammar—CityEngine Tutorials | ArcGIS for Desktop

Here is the help page for gable roofs (there are pages for other roof types as well):

roofGable Operation

Then, you'll probably want to texture your buildings in the CGA code (rather than using the Texturing Tool in the video), so check out the "Texture the simple building" section in Tutorial 6 or the "Texture the facade" section in Tutorial 7:

Tutorial 7: Facade modeling—CityEngine Tutorials | ArcGIS for Desktop

To link object attributes (on the shape - visible in the Inspector) to rule attributes (in the rule file - also visible in the Inspector), make sure they have the same name.  So, if your object attribute is called "height", then use attr height in your rule file.  Then, link them through the connection editor in the Inspector (click on arrow icon next to attribute name in Inspector, choose Object Attribute).