GEOG 497
3D Modeling and Virtual Reality

4.2 Introduction to CityEngine and its CGA Shape Grammar

Print

4.2 Introduction to CityEngine and its CGA Shape Grammar

Introduction

In this section, we focus on an introduction to ESRI CityEngine as an instance of procedural (grammar-based) modeling software. Although this software won’t be used in this course, the result of its procedural modeling will be applied in lessons 5 to 7 that will introduce you to ArcGIS Pro. CityEngine is standalone desktop software. ‘The computer is given a code-based ‘procedure’ which represents a series of commands - in this context geometric modeling commands - which then will be executed. Instead of the "classical" intervention of the user, who manually interacts with the model and models 3d geometries, the task is described "abstractly", in a rule file’ (CityEngine). The set of generic procedural rules can be used or modified when creating virtual cities. Moreover, new procedural rules can be defined, modified, or rewritten to create more detailed and specific designs.

Screenshot of CityEngine user interface showing University Park campus
Screenshot of CityEngine user interface showing the University Park campus.

Please watch the video below to learn more about the user interface and navigation in CityEngine.

Video: CityEngine Essential Skills: Exploring the User Interface and Navigation Controls (15:47)

Click here for the CityEngine Essential Skills video transcript.

This tutorial will give you a quick overview of CityEngine's navigation tools and user interface. And for this project, we'll use the International City we created in the previous tutorial. If you're just joining the series, you can create this project through the City Wizard. To access the City Wizard, go to the File menu and click New. This will open a new dialog box and you can choose City Wizard in the CityEngine folder and then click Next. Give a name to your city. I'm gonna call this one International City. And for our purposes, we can just accept the defaults and scroll through the wizard. Once you're done, click finish. And for me, I've already created this city, so I'll click cancel. Now your city might take a little while to generate but pretty soon you'll have something that looks similar to what you can see here.

Now for this lesson, let's set up a scenario. So just imagine that you're an urban designer and you've been charged with creating a new residential development. To help you complete this task we'll build your understanding of the user interface and develop your skills using the navigation tools in CityEngine.

First, let's look at the main windows in CityEngine. The first is the scene editor. In our scene, we have the environment layers that control the scene's light and the scene's panorama. One of the functions of the scene light layer is that I can come in here and change the solar intensity values. I can decrease intensity to maybe 0.5 and we can see the light change in the scene. I'm going to set it back to 1 just to make the scene a little brighter.

Next, we have map layers and these contain images that make up the base map and the context for your scene. We also have something called the obstacle map layer and this constrains where the city will be generated. So if I go ahead and turn off the heightmap layer, and turn on the obstacle layer, you can see those areas in black represent areas of vegetation and water in the landscape. And CityEngine recognizes that it can't go ahead and build buildings in these areas. So this is a useful way for you to help constrain where your city will actually be generated.

Finally, we have graph layers. What we can see here is a street layer and it's made up of networks. And these are like our edges and nodes and blocks, and these are used for generating shapes and models dynamically using CGA rules.

Next, let's look at the Navigator window. The Navigator is used for project and scene management and consists of the folders you can see here. The first is the assets folder. The assets can be in different formats. For example, obj, and these are used by CGA rules to texture the models you see in the scene. Next is a data folder. I use this folder to store GIS data in a file geodatabase format. You can store things like colada files or other additional datasets here too. The images folder stores additional imagery like viewport snapshots, for example. The maps folder contains the images used by the map layers. So for example, we have the texture image that's creating the base map for this scene. And we also store the obstacle image here that we saw earlier. The models folder is where you can store 3D models exported from the CityEngine scene. The rules folder contains the CGA shape grammar rule files. And these rule files call on the assets that we saw earlier to create the textures for the 3D models. And next is the scenes folder. So the scenes folder is where we store all the scenes that we build in CityEngine. And finally, we have the scripts folder where you can store things like Python scripts.

If you ever need to add any additional data to any of these folders you can easily do that by dragging and dropping from your native file browser. You have the option here to configure the drag-and-drop setting, so I can link to files so if they're updated on my folder system they'll update directly in my navigator or my workspace as well. Or I can choose to copy the datasets into the workspace. Besides project management, this window lets us open a scene by right-clicking and we can also access the CGA rule editor window by double-clicking on one of the CGA rules in the rules folder. Once the CGA rule editor is open, we have the option to view and edit the rules either in a text view, which we can see here, or a visual view. And we'll cover CGA rule editing in more detail later. And I'll just switch it back to the textual view.

Now let's take a look at the inspector window. The inspector shows all the attributes and the parameters of the assigned CGA rules. To view rule parameters, first select some buildings by holding the left mouse button down and dragging from left to right. You see a blue rectangle on the screen and when you release it, you can see some buildings highlighted in blue. And then in the inspector window on the right, you can see under the street parameters, the different values available to change. So we have things like street width and sidewalk width and I can update these based on my design intent or maybe feedback from a client. And finally, we have the log window. And this window is useful for troubleshooting errors or if you're getting any strange behaviors. And it gives you good feedback ranging from informational messages to severe errors like out of memory for example.

Okay, now we have an overview of some of the windows in the user interface. Let's take a look at one of the main windows, which is a 3D viewport. And this is where we visualize and interact with the 3d scene and it's where I'll sketch out the new development. First, let's choose an area suited for new development. From looking at the scene, I think somewhere down by the waterfront would be good. To zoom to this area, hold the left mouse button down and drag from left to right to select some of the streets. Then click on the frame selection tool from the toolbar in the top right of the viewport. This quickly zooms me into the area. Another way to quickly navigate to this area is to create a bookmark. The bookmark menu is located in the top right of the viewport window and it has a small star icon. Click on this and then from the drop-down menu choose to create a new bookmark. I'll call this one project area and click OK.

So now that I've saved the extent of my project area, I can quickly zoom out. So if I press the A key, it will zoom me out to the extent of my whole project. And to zoom back again, I'll go up to the bookmark menu and choose project area. Depending on what you're doing in your project, you might like to have another viewport window open to give you a more complete view of your project or of your scene. So for my purpose. I think I would like to have the perspective scene as well as a plan view or a top-down view. To do this, I can open a new viewport window from under the window menu, and I can click and drag the viewport and drop it below my original viewport window. If I click on the camera views, you can see that this is in a top-down view. Now I chose this view for my specific purpose, but there are also a number of default views that you can use and they're designed for other tasks. So the first one is called the default view, handily enough, and this one is really good for an overview of your scene and for management tasks like import and export. The next one we'll take a look at is called the minimal layout. Now this one has a perspective view and some editors open, which makes it pretty good for presentations. The next two views are similar to the default views, but we get two views. So we have a perspective at the top here and a plan view at the bottom. And you can also have this in a vertical layout. And then finally to make rule editing more efficient, we have a couple of views here. Let's take a look at the standard rule editing view. This layout has one perspective view and leaves more area for the CGA editor, so it's especially suited for editing rules.

Okay, now I'm just going to return to the default layout because that's going to suit my purpose of sketching out the new development. Now before we get started with some of the navigation in the scene, I want to show you some of the view settings that you can adjust, so you can see the models better. So under the view settings menu, here I'm going to uncheck Wireframe on Shaded Textures. And now we can get a better view of what our models are going to look like. Now let's save this perspective view. So under the window menu, choose Layout and then Save Perspective As. Then all you have to do is give this a name. For me, I'll call this project view and choose okay. So now I have this perspective saved if I ever want to use it in a future project. Now I have a viewport layer, let's look at how to navigate. So I can use the navigation tools, tumble, track, or dolly. Or it's even easier to use the shortcut keys. So here we have alt and the left mouse button and to pan, alt and the middle mouse button and then to zoom in and out, I'm using the alt key and the right mouse button. A recommended navigation workflow is to select the features or the area that you want to work in and choose a frame selection tool. Once you're zoomed in closer, you can explore the selection using the tumble, track, and dolly shortcut keys. Also, if you ever want to deselect a selected feature, you can just hold down the ctrl, shift and A keys.

Now let's look at how we can interact with the models in the viewport using selections. Selecting features is also an essential skill for applying rules. So one way we can select features is using a rectangle. So here from left to right if I drag, I select all the features that fall inside the rectangle. But if I go from right to left, I get all the features that touch the borders of the rectangle, as well as fall inside. Another thing I can use is from the selection menu. So I can choose to subtract from the selected features, and we see the result there. I can also do things like invert the selected features, and we can see the results in the window here. And then to deselect the selection, you can do control, shift and A.

Now let's see how we can use selections to apply rules for their new development. In this step, we'll use some of the object edit & transform tools to create the new development. First I'll zoom back to the study area using the bookmark. And the tools that we're looking for are located here above the viewport. I'll select the polygon street creation tool and quickly sketch out some streets and blocks for the new development. I'm going to select some of these blocks, so I'll do the drag a rectangle selection technique. And if I right-click, I can choose select, and from the context menu, I'm going to choose select objects of the same group. Then under our block parameters in the inspector window, I'm going to change the type to recursive subdivision, and adjust some of the lot areas. Once I'm happy with the design, I'll go back in and select the blocks again, and right-click and choose select objects of the same group. And then I'm going to drag and drop this international city rule directly on to my selected features. And straightaway you can see we've generated a new urban development. So in the inspector window, you can see under the International City group we have some parameters available to change. So under type, we have different building types, high-rise, office, residential. I'm going to leave this as apartment.

And sometimes when you're working with a complex scene like this one, if you want to make an edit, it's useful to be able to select the building you want to interact with and then isolate it. So to do that, select a building with your selection tool and then press I on the keyboard to isolate the selection. And then you're able to come in and edit the specific building you're interested in. So here I'm changing the tree type to a random forest mix, and I'm changing the building type to an office building. So once you're happy with your edits, you can press I, and your models will come back. Now if we press the A key, we can zoom out to see the entire scene. I'll zoom in a little bit here. When you're finished with the visualization and you want to see perhaps more of your model, you can press the spacebar and this will maximize your screen real estate by hiding some of the other windows. Now we'll change some of the display settings so we can see the models a little bit better. So here I'm going to add some shadows. I think I'll also add the ambient occlusion as well. And then we'll turn off the grid that you can see there so we can better see the models. These kinds of view settings are really good if you want to take some high-quality screenshots of your CityEngine scene.

Okay, so now you know your way around CityEngine. You'll use your navigation skills and project management knowledge in the next tutorial, which shows you how to create your first CityEngine project.