[032] How to Create 3D Volumes Using Extrude in Esri CityEngine

Understand the extrude command to transform flat 2D shapes into 3D building volumes with precise control over verticality and roof flatness.

This tutorial marks the transition from 2D procedural modeling to 3D space in CityEngine. You will learn the syntax of the extrude command, how to handle extrusions on sloped surfaces using world coordinates, and how to ensure building rooftops remain perfectly level regardless of terrain inclination.

Recommended Audience: Beginners in CGA modeling and GIS professionals looking to generate basic building masses from footprint data.

We are finally moving from planes to 3D volumes.

While the transition to 3D might seem like the most critical topic to cover, it is actually one of the simplest commands in CGA, with almost no complex parameters to manage.

The syntax is as follows:

Syntax


extrude (distance)
extrude (extrusionType, distance)

Reference: CityEngine CGA Extrude Documentation

Simply inputting a height value will automatically raise the shape by that specific distance. I will explain a few points to be careful about and then wrap up.

Take a look at the image below.

Three initial shapes: one vertical, one flat on the ground, and one sloped
img 1 : Three different initial shape orientations

In this scene, one face is standing vertically, one is flat on the ground plane, and another is tilted at an angle. Let's give each object a height value of 50m and extrude them.


Lot --> extrude (50)

The syntax is straightforward. Let's examine the results.

Result of basic extrusion showing the shapes protruding based on their face normals
img 2 : Default extrusion based on face normals

As you can see, the objects protruded in the perpendicular direction of the face—more precisely, along the face normal. The one on the right extruded at an angle, much like the Leaning Tower of Pisa.

Performing an extrusion by only providing a height value without an extrusionType means that face.normal is applied by default.

So, how do we make even a tilted shape extrude vertically upward?

You can enter world.up for the extrusionType as shown below.


Lot --> extrude (world.up, 50)

And the result?

Extrusion using world.up where all shapes move vertically regardless of their slope
img 3 : Extrusion using world.up

Yes, the objects have risen vertically regardless of the shape's inclination. The object on the far left simply shifted upward without forming a meaningful solid volume. The one on the right rose vertically, but the original slope of the shape was maintained at the top.

However, in a typical building, the top of the building doesn't usually slope just because the terrain is inclined. We need to "trim" the top to be flat.


Lot --> extrude (world.up.flatTop, 50)

You can achieve this by entering world.up.flatTop as the extrusionType.

The results:

Extrusion using world.up.flatTop resulting in buildings with perfectly flat roofs
img 4 : Leveled rooftops using world.up.flatTop

Indeed, the top has become flat. The flatTop height is determined relative to the lowest vertex of the original shape. For both the left and right examples, the height was capped at the 50m line relative to that lowest point.

This covers most of what is used in actual professional practice. It's quite simple, isn't it?

While there are other extrusion types like face.normal and vertex.normal, you can easily understand them by looking at the diagrams in the CGA reference without further explanation.

This concludes the overview of the extrude command. 

Next, we will cover comp (Component Split), which is used just as frequently as split in CGA.

"Simplicity is prerequisite for reliability."
— Edsger W. Dijkstra
Continue Learning
Explore complete tutorial collections for CityEngine and Global Mapper.

Comments

Popular posts from this blog

029] How to Split Polygon Areas with Intersecting Lines in Global Mapper

[008] How to Understand CGA Rule Structure in CityEngine (Beginner Guide)

046] How to Create Parallel Offset Lines in Global Mapper