Basic Training
City Engine from Scratch
This project introduces the file management architecture for a multi-scale-multi-temporal metropolitan city model that can be updated by any number of individuals in organizations around the city. We begin by looking at the directory structure for the model. We take a look at hthe procedure for creating a new project by extracting data layers from from sources. Finally we take the plunge into CityEngine.
Credit is due to Patrick Gahagan of ESRI for providig us with an excellent City Engine project to use as our template. Here is a link to the web scene that Patrick made for this project.
Explore a City Engine Project
We will begin by looking at a project in CityEngine. We will then start our own city engine project and use it to understand the way that CityEngine uses Data and Rules to create Scenes.
The documentation and tutorials for CityEngine are all over the place. There are many useful tutorials in PDF format that are buried in various tutorial datasets. I've created another page that I use to organize several of these and to keep track of the topics and techniques that they cover. See CityEngine Resources. The techniques that we will be using are covered fairly well in the following City Engine tutorials and manual pages:
References
Download and Organize the Data Architecture
To begin, we need to assemble the downloaded dataset into an organization that follows our architecture for city model development, and also meets the expectations for CityEngine. The gist of this organization consists of a Cambridge_3d folder that contains Sources folder and a Projects folder. We will download the CentralSquare Project Dataset and extract its contents into the Projects folder.
Explore the CityEngine Interface and Patrick's City Engine Project
We will use Patrick's city Engine project to explore the basics of city Engine. You can read all of the details in the Quick Start Guide of the City Engine Tutorial.
To load Patrick's project, use File > Import > Project > Existing Project Into Workspace. Use the file browser to find the folder CentralSquare_pbc, which is the root folder for the project. This wil copy everything into your default CityEngine workspace, which is in C:/users/yourusername/CityEngine.
Rebuild Patrick's Project in a New City Engine Scene
Now we are going to get our hands dirty by rebuilding Patrick's project. We will basically be following many of the same steps that are covered in 3D City Creation
Create a New Scene
Begin by right-clicking the Scenes folder in the explorer, and choose New > City Engine Scene. When asked for a projection, choose Massachusetts State Plane NAD83 Feet. This has to match the projection of all of your data. Then you can start adding data to the scene.
Be sure that your view settings are adjusted so that you can see all sorts of geometry. These settings are turned on and off with these buttons at the top of the view window. Press them all until they are all punched in.
This is a list of the layers in the Cambridge CityEngine project and the associated rules that render them. The usual process fo radding a layer to CityEngine is to find a shape file or geodatabase in the Data folder (in the upper left panel of the Navigator. Drag the shape file or geodatabase into the view window. This wil create a layer in teh Scene Navigator (lower left corner of your screen.) You select all of the objects in the layer by right-clicking it and choosing Select > All Objects in Same Layer. Then in the Inspector Window (right side of the screen) you assign a Rule file and a Start Rule.
- Load a Georeferenced Image We will start by importing the aerial photograph that is in the Maps folder. Then we will import a sequence of shape files form the Data folder.
- Load Street Centerlines and Populate the Streets Use the 3DCity StreetCreation rule. Don't Choose a Start Rule
- After loading the street centerlines we will play with some of the amazing ways that the streets can be populated with cars and people.
- Load BuildingZoning Rule: CambridgeBuildingRenderer.cga, select the Start Rule, Model. Note that we have to flatten the buildings by selecting them all and using the Alighn Shapes to Terrain Tool.
- Try flipping the RenderZoning option for the CambridgeBuilding Renderer.
Here is a quick list of the other layers we will load and their associated CGA Rules and Start Rules:
- Layer:... Rule File:... Start Rule:...
- Paved_Roads_Split and Parking Lots: Pavement Marking CGA, Pavement
- Plazas and Sidewalks: PavementMarking.cga, Sidewalk
- Walls: walls.cga, Wall
- TreeWells: PavementMarking.cga, TreeWell
- StreetTrees: Vegetation.cga, Point
For street furniture represented as points, use the Street Furniture.cga rule with the Point start rule. Then you choose the object to use the Model Asset option in the inspector window. The source shape files for these layers incorporate Z information. This makes the objects appear to float. To bring them back to the ground, select them all and choose Shapes > Align Shapes to Terrain using the default settings. This wil make the shapes sit at zero or if you had a teerrain surface defined, it would make them sit at the right spot on that model.
- Trash Barrels: 4 - Street Furniture.cga, Point
- Park Benches, WalkSignals, TrafficSignals Same
Pavement markings: Import with all of the street creation options unchecked. Select all in same layer, then in the Inspector window, unroll Shape Parameters > Street Parameters and set the width and precision to 0.1. Turn on Shape creation for Lines and Off for nodes.
- Pavement Marker Polys: Pavement Marking CGA, PMPolygons
- Pavement Marker Lines: Pavement Marking CGA, PMLines
- Parking Lot Markings : Pavement Marking CGA, PMLines Street Width 0.1 Precision 0.1
Finish and Save your Scene
When you are ready to take a break, or if you simply want to be safe, you can use File > Save to save your scene. If you want to be really safe, or want to share your project with someone, choose File > Export > Archive wrap up the entire project as a zipped archive file.
Proposed Challenge Exercise for Part 1.
- Import the PGCentralSquare project to your own city engine workspace.
- Create your own scene and import all of the layers using all of the rule settings as described above.
Part 2: Adding True 3d Buildings, Elevation, CGA Buildings and Making a Web Scene
Refresh this page later this morning for updates!
Now we are going to take our CityEngine project to new levels of detail. We'll load the latest CyberCity3D buildings for the context of the Quest site. Then we will set up a terrain model and adjust all of our layers to it. We wil luse the 3D building models to create a Before picture for our development site. Then we will use some very elaborate CityEngine rules to create some development propiosals. Finally , we will set up a web scene like this one created by Patcick Gahagan.
NEW DOWNLOAD! centralSquareSupplement.zip This download includes the CyberCity models for a ring around our site. Download this and copy the resources from it into the appropriate folders of your existing CityEngine project. This file has been updated as of Feb 1 2014 at 12:21!.
Load the CyberCity Buildings
Two important innovations in GIS that make city modeling more useful: 1. the development of true 3d datatypes that can be managed in relational tables just like points lines and polygons. And, 2. The development of inexpensive methods for crating detailed 3d models of rooftops and the massing of buildings from standard photogrammetry. In our case we are going to use the ESRI MultiPatch format inside a personal geodatabse feature-class, which holds a set of models developed by CyberCity3D. These models have a lot of dreail and rendering them in CityEngine demansa a lot from the graophics card of computers, so we have created a clop of just the buildings surrounding our site. There is a donut called Quest_context3d and an island of buildings called quest_demo3D. The QuestDemo3D models represent the Before picture of our development site. We will create an After Picture using CityEngine rules.
Loading and Correcting 3D Multipatch Buildings
- You have already put the GeoDatabase from the sample dataset, above, into the data foldder of your CityEngine project. You may need to right-click your Data folder and refresh it.
- Now right-click the geodatabse and choose Import and then choose the option for File GDB. You will be presented with a list of the feature classes inside to choose. Choose them all.
- Now you should see your multipatch buildings. If not, yo may need to fiddle with the at the top of the view window.
- The building models look all black. This is because their surface normals are flipped. Essentially, they are inside-out. Most comput4r programs only render one side of surfaces. What we see here, is that City Engine is not shading these faces. In other tools, like WebGL, we would not see these at all. Luckily the solution is easy, since they are all flipped, we wil select all of the multipatches and choose Shape > Reverse Normals.
- Now figure out hos to turn on and off the Bldg3D_Demo feature class -- effectively simulating the clearance of the Quest site.
The problem of Terrain
Now that we have 3d Buildings we can see that they do not touch the ground the way that they should. we are going to have to load the terrain model. City Engine has some limitations in terms of handling terrains. Since CityEngine has to load tyour complete scene onto the graphics card of your computer -- its ability to handle lots of data is limited. WebScene technology, (WebGL) is even more restrictive. Therefor, it is recommended that the rterrain models that we load should be less than 4000x4000 pixels. In practice I see that people are using terain models and texture images that are as smapp las 500x500. which actually is not that bad if you keep your models down to a Kilometer circle, like Patrick has done.
Take a look in the Maps folder of your prioject. You will find a geotif CentSqFt1.tif. And a low-res orthophoto, CentralSquare5K.jpg. These are both GeoReferenced. If City Engine finds a jgw and a tfw file with the images, then it knows how to overlay them, even if they have different extents and pixwel dimensions. Note however that later versions of ArcMap create world files with the with the .tfwx and jgwx extensions. No worries, just remove the x!.
Load a DEM with Draped Texture
- Right-click the geotif CentSqFt1.tif and choose Import
- CityEngine should propose the correct projection, Mass State Plane NADF83 Feet. Pick that.
- Al lof the blanks in the next dialog for the Height Map and its dimensions and the High-and Low values should be properly filled in.
- For your Texture Map, choose the jpeg file, CentralSquare5K.jpg.
- When you click OK, you should now have a terrain with a draped texture.
Adjusting the Roads and Other layers to the terrain
Now that we have terrain we now have to adjust some of our layers. This isn't too difficult. All we need to do is select all of the features and choose Shapes > Aligh to Terrain or you can use the short-cut button,
Create a Development Idea for the Quest Site
By now we should have a project that allows us to portray the neighborhood surrounding the Quest Pharmaceuticals redevelopment site. Our model includes detailed buildings within the site and in the immediate Context and rougher, extruded buildings in the Surrounding Area. I've put the terms Context and Surround in bold because these will be important concepts in our terminology about site modeling. We'll come back to this.
The key thing is that you know which layers you can flip on and off to show the pre-existing condition of the site, and then to view the cleared site within its context.
- Load the shape file named redev_parcels.
- It is time to get methodical about naming things. With all 8 the Redev Parcels shapes all selected, go to the inspector window and change the name of this layer to Quest Scheme 1.
- Now apply the rule, 3D_CityDesign_Rules/Building_Construction.cga
- After you push the Generate button you should sww some blue buildings and hedge-filled yards.
- Roll down in the Inspector window and push the button next to the Facade Construction panel. If this Facade-Picker window is very slow to draw, use the display options , button to Scroll View. Pick an interesting Facade type.
- Adjust the Footprint Layout.... Try U-Shaped.
- If you have a flat roof, you can put on solar panels.
- When you get a scheme that you might want to look at later, you can load the redev_parcels.shp again and start a Quest Scheme 2!. Etc, etc.
Challenge Exercise 1
There are scores of interesting settings that you can adjust for these schemes in the options panel. Your challenge assignment will be to experiment with all of them!!!
Create a Web Scene
Our web scene will allow us to show two schemes and explore each of them from different points of view in the neighborhood and to look at shadows under 24x360 different lighting scenarios. We will be using this reference for creating web scenes. But there is some set-up that we will want to do before plunging into that.
Set Up for your Web Scene
- Set Up BookMarks: Bookmarks are set with the Bookmarks button. Pick a few viewpoints that you think bring out critical aspects of the site design. Maybe a Birdseye View and a couple of Street Level Perspectives.
- Figure out your Layer Options: When you get into making your WebScene, you will need to assign the layers in your scene that represent alternative schemes to a Layer Group This group is what establishes the right-and left view in your web-scene's slider window. So before you start the process of making a web scene, get your layers arranged so that everything looks good with the existing condition. And flipping the Existing Condition 3d Buildings layer off, and Quest Scheme 1 buildings on, you see that scheme. Any layers that you do not want in the web scene should be turned off. All layers that you do want in the model should be on -- including both the Existing Condition Buildings and the Quest Scheme 1 buildings.
- Select your Entire Model: You can use Ctrl-A to zoom extents on your entire model. Then use your select arrow to drag a box around everything.
- Finally, go to File > Export Models to begin the process of creating a web Scene.
At this point, the CityEngine documentation on webscenes will take you through the process of creating and previewing a web scene. After our experience in class on Thursday, we now know that we need to figure out how to make sure that our scene preview opens up in a browser that is WebGL compatible. More on that soon!!.
Proposed Challenge Exercise
- Create an interesting Web Scene.