[007] How to Perform Viewshed Analysis in CityEngine

In this tutorial, you will learn how to use the built-in Viewshed Creation tool in CityEngine. We will move beyond traditional 2D line-of-sight mapping to perform highly accurate 3D visibility analysis, taking into account terrain, building heights, and precise camera angles.

In landscape review reports or environmental impact assessments, viewshed analysis is a methodology you will frequently encounter.

Originally used in telecommunications to identify radio wave shadow areas, it has been widely adopted in landscape architecture to evaluate changes in visual obstruction before and after a construction project.

Let's look at a common visual example of how viewshed analysis is typically presented.

[img 1 : Traditional 2D viewshed analysis example showing red visible areas]
[img 1 : Traditional 2D viewshed analysis example showing red visible areas]

This is a viewshed analysis conducted from position 1, where the red areas indicate the regions that are visible from that specific point.

While this particular image includes both terrain and buildings in the analysis, traditionally, most of these analyses rely solely on terrain (elevation) data.

If you perform a viewshed analysis using only terrain data, the result might falsely show the target site as perfectly visible, even if a 10-story building is completely blocking the view right in front of the observer.

Furthermore, even if existing buildings are somehow factored into a 2D analysis, it is impossible to determine exactly from which floor a specific building becomes visible.

💡 Practical Tip: This limitation is why 3D Digital Twins are essential for modern urban planning. By combining DEM (Digital Elevation Models) with extruded 3D building massings, CityEngine provides a true representation of urban sightlines.

Step 1: Setting Up the Scene

Launch CityEngine.

Today, we will not create a new scene. Instead, please load the scene you saved from our previous lecture: [002-003] How to Create Terrain and Align 3D Buildings in Esri CityEngine.

Have you loaded the scene?

[img 2 : 3D urban scene with terrain and buildings ready for viewshed analysis]
[img 2 : 3D urban scene with terrain and buildings ready for viewshed analysis]

From the top toolbar, select Visibility tools -> Viewshed creation.

[img 3 : Selecting the Viewshed Creation tool from the CityEngine toolbar]
[img 3 : Selecting the Viewshed Creation tool from the CityEngine toolbar]

Step 2: Creating the Viewshed

Imagine looking from your viewpoint toward the main target or project site. Click on position 1 (the observer point), and then click on position 2 (the target direction).

[img 4 : Setting the viewpoint and target point in the 3D viewport]
[img 4 : Setting the viewpoint and target point in the 3D viewport]

Simple, right? The viewshed analysis is complete.

The green areas represent the visible parts, while the red areas represent the obstructed (hidden) parts. (You can also change these colors later).

What do you think of this 3D approach to viewshed analysis?

While traditional 2D viewshed analysis was limited to analyzing visible and hidden areas on a flat plane, 3D viewshed analysis can distinguish visible areas right down to the actual building facades.

Step 3: Refining Camera Parameters

Now, let's refine this a bit more to simulate real-world conditions.

Viewpoint photographs are typically taken using a standard angle of view (a horizontal field of view of roughly 39.6 degrees), which corresponds to a 50mm focal length on a full-frame camera, at an average human eye level of 1.6 meters.

(Yes, that's correct. It is perfectly fine to adjust the angle of view depending on the scale of the project site and the specific conditions of the viewpoint.)

Anyway, for now, we will adjust the settings to match this standard angle of view.

In the Scene panel, select the Viewshed 1 object you just created.

[img 5 : Selecting Viewshed 1 from the Scene panel under Analyses]
[img 5 : Selecting Viewshed 1 from the Scene panel under Analyses]

Let's take a look at the Inspector panel.

[img 6 : Adjusting properties in the Inspector panel for the viewshed]
[img 6 : Adjusting properties in the Inspector panel for the viewshed]

Change the Horizontal Angle of View to 39.6, and add 1.6 to the Observer Point Y value.

The reason we add 1.6 to the Observer Point Y value is that your initial mouse click snaps directly to the ground level.

💡 Practical Tip: Never forget to add the 1.6m (or your target eye-level) to the Y-axis! If you leave it at 0, your entire viewshed analysis will simulate the perspective of someone lying flat on the pavement.

After making these adjustments, you can appropriately change the composition in the 3D View, capture the screen, and insert it directly into your report.

[img 7 : Adjusted 3D viewport showing the refined viewshed analysis]
[img 7 : Adjusted 3D viewport showing the refined viewshed analysis]

It is distinctly different from 2D analysis, isn't it?

Step 4: Analyzing Multiple Viewsheds (Overlaps and Blind Spots)

You can also create multiple viewsheds to identify overlapping areas.

Where would this be used?

By synthesizing the field of view of CCTV cameras planned for installation in various locations, you can easily pinpoint blind spots in security coverage.

Try installing a couple more virtual cameras in the scene and follow the steps below. (Each Viewshed must be located within the same Analyses layer.)

[img 8 : Multiple viewsheds projecting across the 3D urban model]
[img 8 : Multiple viewsheds projecting across the 3D urban model]
[img 9 : Scene panel showing multiple Viewshed objects grouped under Analyses]
[img 9 : Scene panel showing multiple Viewshed objects grouped under Analyses]

Select the main Analyses layer in the Scene panel. In the Inspector window, change the color for Visible by multiple. The overlapping visible areas will then be displayed in yellow.

The blind spots will remain highlighted in red.

Visual diagram mapping CGA code lines to CityEngine Inspector UI elements
[img 10 : Inspector panel options for the entire Analyses layer, adjusting overlap colors]

It is a remarkably simple task that finishes with just a couple of mouse clicks.

We will conclude the functional viewshed analysis tutorial here.

💡 Practical Tip: When setting up multiple viewsheds, make sure they are all grouped under a single Analyses parent folder in the Scene panel. If they are separated, CityEngine cannot calculate their intersections for the 'Visible by multiple' feature.

Bonus: A Tip for Real-World Viewpoint Photography

Ah, here is a practical tip for taking viewpoint photographs on site.

There are common mistakes people make when capturing viewpoints in the field.

You might have experienced trying to composite a real photo back at the office, only to find the project site falls outside the horizontal field of view. Or, when dealing with a tall building, an incorrect tilt angle leaves the top or bottom floors completely cut out of the frame.

To prevent this, you might have experienced turning yourself into a human panoramic tripod on site, snapping dozens of unnecessary photos just in case.

If you create a camera in CityEngine using this Viewshed information as a reference, and take that camera snapshot image with you to the site as a guide, you can always capture accurate, perfectly aligned photographs the first time.

Conclusion and Next Steps

To take a break from the heavy theory, we covered one of CityEngine's built-in, out-of-the-box features today.

Our next lecture will return to CGA.

[008] will be about understanding the framework of CGA code.

Don't worry. We are still a long way from actual, intensive coding.

It's just about grasping the outline, understanding 'Ah, so this is the general flow of how coding works.'

Previous Post
Next Post
Related Posts
  • To learn the fundamentals of procedural modeling and 3D terrain alignment in CityEngine, see [003] How to Create Terrain and Align 3D Buildings in Esri CityEngine
  • To automatically generate accurate camera viewpoints from viewshed data, see [115] How to Create Bookmarks from Viewshed Analysis in CityEngine
  • To automate time-lapse snapshot exports for dynamic sunlight and shadow analysis, see [137] How to Automate Solar Shadow Simulations in CityEngine
  • To automatically generate complex camera viewsheds from imported CSV coordinates, see [141] How to Automate Viewsheds from CSV in CityEngine

If you have any questions, please leave a comment. Let's solve them together!


[A Quiet Thought]

"The real voyage of discovery consists not in seeking new landscapes, but in having new eyes."
— Marcel Proust, In Search of Lost Time

A viewshed analysis in CityEngine gives us precisely these 'new eyes.' By calculating exact lines of sight, it removes human guesswork and reveals the hidden visual impact of our designs. Whether we are assessing the environmental footprint of a new skyscraper or positioning a security camera to eliminate blind spots, shifting our perspective through hard spatial data ensures our digital cities serve their true, intended purpose.

May you continually find new ways to view the world you are building.

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